diff --git a/Robot2016/src/Robot.cpp b/Robot2016/src/Robot.cpp index 3111ca2..8e4b800 100644 --- a/Robot2016/src/Robot.cpp +++ b/Robot2016/src/Robot.cpp @@ -118,6 +118,13 @@ private: launch_spinny.Set(0); } + /* + * Run the Shooter only while the THUMB button is held down on the operator stick. + * the 'pickupRunning' boolean is there to prevent the shooter from calling PickUp + * every itteration of the TeleopPeriodic method (once every 10ms!) + * The pickup is disabled when the thumb button is released, but the code still + * has 'pickupRunning' as true. + */ if(operator_stick.GetRawButton(THUMB) && !pickupRunning) { shooter.PickUp(); @@ -129,6 +136,12 @@ private: pickupRunning = false; } + /* + * The 'inverting' variable is used to make sure that the drive train isn't getting + * inverted every itteration of the TeleopPeriodic method while the button is held down. + * This is important because the TeleopPeriodic method executes something like once every 10ms. + * Thus, this if-else if pair make the button a toggle. + */ if(driver_stick.GetRawButton(THUMB) && !inverting) { left_drive.SetInverted(!left_drive.GetInverted()); @@ -140,7 +153,10 @@ private: inverting = false; } - if(((1.0 - operator_stick.GetThrottle()) / 2.0) > shooter_power + 0.005||((1.0 - operator_stick.GetThrottle()) / 2.0) < shooter_power -0.005) + + + if(((1.0 - operator_stick.GetThrottle()) / 2.0) > shooter_power + 0.005 + || ((1.0 - operator_stick.GetThrottle()) / 2.0) < shooter_power -0.005) { shooter_power = (1.0 - operator_stick.GetThrottle()) / 2.0; shooter.SetPower(shooter_power);