2017-10-17 21:37:58 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
2017-10-17 21:37:58 -07:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <Commands/Subsystem.h>
|
|
|
|
|
#include <DigitalInput.h>
|
2017-11-03 13:22:56 -07:00
|
|
|
#include <Spark.h>
|
2017-10-17 21:37:58 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The claw subsystem is a simple system with a motor for opening and closing.
|
|
|
|
|
* If using stronger motors, you should probably use a sensor so that the
|
|
|
|
|
* motors don't stall.
|
|
|
|
|
*/
|
|
|
|
|
class Claw : public frc::Subsystem {
|
2018-05-13 17:09:56 -07:00
|
|
|
public:
|
|
|
|
|
Claw();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
void InitDefaultCommand() override;
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/**
|
|
|
|
|
* Set the claw motor to move in the open direction.
|
|
|
|
|
*/
|
|
|
|
|
void Open();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/**
|
|
|
|
|
* Set the claw motor to move in the close direction.
|
|
|
|
|
*/
|
|
|
|
|
void Close();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/**
|
|
|
|
|
* Stops the claw motor from moving.
|
|
|
|
|
*/
|
|
|
|
|
void Stop();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
/**
|
|
|
|
|
* Return true when the robot is grabbing an object hard enough
|
|
|
|
|
* to trigger the limit switch.
|
|
|
|
|
*/
|
|
|
|
|
bool IsGripping();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
void Log();
|
2017-10-17 21:37:58 -07:00
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
private:
|
|
|
|
|
frc::Spark m_motor{7};
|
|
|
|
|
frc::DigitalInput m_contact{5};
|
2017-10-17 21:37:58 -07:00
|
|
|
};
|