Added Shooter class.

This commit is contained in:
Jason 2016-02-02 10:18:19 -05:00
parent 72c9268b13
commit fae8d71f03
2 changed files with 38 additions and 6 deletions

View File

@ -15,7 +15,7 @@ class Robot: public IterativeRobot {
CANTalon shooter1;
CANTalon shooter2;
TankDrive drive;
Shooter shooter;
Joystick rstick, lstick;
// update every 0.01 seconds/10 milliseconds.
@ -24,11 +24,19 @@ class Robot: public IterativeRobot {
public:
Robot() :
r1_drive(1), // Initialize the Talon as device 1. Use the roboRIO web
r2_drive(2), // interface to change the device number on the talons.
l1_drive(3), l2_drive(4), shooter1(10), shooter2(11), drive(
&l1_drive, &l2_drive, &r1_drive, &r2_drive), rstick(0), lstick(
1) {
r1_drive(1), // right wheel 1
r2_drive(2), // right wheel 2
l1_drive(3), // left wheel 1
l2_drive(4), // left wheel 2
shooter1(10), // shooter drive 1
shooter2(11), // shooter drive 2
drive( // initialize TankDrive object.
&l1_drive, &l2_drive, &r1_drive, &r2_drive),
shooter( // initialize Shooter object.
&shooter1, &shooter2),
rstick(0), // right stick (operator)
lstick(1) // left stick (driver)
{
}

24
DriveBase/src/Shooter.h Normal file
View File

@ -0,0 +1,24 @@
/*
* Shooter.h
*
* Created on: Feb 2, 2016
* Author: Jason
*/
#ifndef SRC_SHOOTER_H_
#define SRC_SHOOTER_H_
class Shooter {
RobotDrive shooterDrive;
public:
Shooter(CANTalon *s1, CANTalon *s2) {
shooterDrive = RobotDrive(s1, s2);
}
virtual ~Shooter();
void SetPower(float power) {
shooterDrive.ArcadeDrive(power, 0, false);
}
};
#endif /* SRC_SHOOTER_H_ */