This repository has been archived on 2020-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
FRC2016/src/Shooter.h

66 lines
1.2 KiB
C
Raw Normal View History

/*
* Shooter.h
*
* Created on: Feb 2, 2016
* Author: Jason
*/
#ifndef SRC_SHOOTER_H_
#define SRC_SHOOTER_H_
2016-02-11 17:17:42 -05:00
#define PICKUP_POWER 1.0
class Shooter {
public:
/**
2016-02-11 16:51:13 -05:00
* Shooter talons and launch-spinny talon.
* s2 is also for the pickup-mechanism and can be controlled independently.
*
*/
Shooter(CANTalon *s1, CANTalon *s2, CANTalon *r) {
2016-02-10 15:23:07 -05:00
// shooterDrive = new RobotDrive(s1, s2);
launcher = s1;
pickup = s2;
2016-02-11 16:51:13 -05:00
launch_spinny = r;
}
/**
* Call this method on TeleopInit so that the ramp is properly
* set at the beginning of the match.
*/
virtual ~Shooter() {
2016-02-10 15:23:07 -05:00
delete launcher;
delete pickup;
2016-02-11 16:51:13 -05:00
delete launch_spinny;
}
void PickUp(bool state = true) {
pickup->Set((float) (state * PICKUP_POWER));
2016-02-11 17:17:42 -05:00
launch_spinny->Set(-1.0*PICKUP_POWER);
2016-02-10 15:23:07 -05:00
std::cout << "picking up!\n";
}
/**
* Call this to run the pickup backwards if the ball gets jammed somehow...
*/
void Unjam()
{
pickup->Set(-1 * PICKUP_POWER);
}
void SetPower(float power) {
2016-02-10 15:23:07 -05:00
pickup->Set(power);
launcher->Set(power);
std::cout << "setting shooter power" << std::endl;
}
private:
RobotDrive *shooterDrive;
2016-02-10 15:23:07 -05:00
CANTalon *launcher;
CANTalon *pickup;
2016-02-11 16:51:13 -05:00
CANTalon *launch_spinny;
};
#endif /* SRC_SHOOTER_H_ */