From 38c09abe0866b350f51a9e22d1ab3bd032706ce2 Mon Sep 17 00:00:00 2001 From: Aidan Ferguson Date: Wed, 10 Feb 2016 18:56:38 -0500 Subject: [PATCH] Made sure shooter power from the throttle will only be used when the throttle is moved. Probably. --- src/Robot.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 05563dd..c7964b8 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -19,6 +19,7 @@ class Robot: public IterativeRobot RobotDrive drive; Shooter shooter; Joystick driver_stick, operator_stick; + float power; public: Robot(): left_drive(0), // Left DriveTrain Talons plug into PWM channel 1 with a Y-splitter @@ -100,6 +101,7 @@ private: { shooter.CalibrateRamp(); shooter.SetRamp(Shoot); // start in the full up position! + power = 0; } void TeleopPeriodic() @@ -143,10 +145,14 @@ private: inverting = false; } - float power = (1.0 - operator_stick.GetThrottle()) / 2.0; - shooter.SetPower(power); + if(((1.0 - operator_stick.GetThrottle()) / 2.0) > power + 0.005||((1.0 - operator_stick.GetThrottle()) / 2.0) < power -0.005) + { + power = (1.0 - operator_stick.GetThrottle()) / 2.0; + shooter.SetPower(power); + } } + void TestPeriodic() { lw->Run();