Switch arms movement from buttons to operator_stick Y axis

This commit is contained in:
Adam Goldsmith 2016-03-05 16:43:40 -05:00
parent 516f0d1675
commit 58b65411dc

View File

@ -19,6 +19,8 @@
#define RAMP_LOWER 3 // Button 4 to lower ramp. #define RAMP_LOWER 3 // Button 4 to lower ramp.
#define UNJAM 11 #define UNJAM 11
#define ARMS_SCALE 0.75
#define DEADZONE_RADIUS 0.05 // Deadzone Radius prevents tiny twitches in the joystick's value from #define DEADZONE_RADIUS 0.05 // Deadzone Radius prevents tiny twitches in the joystick's value from
// affecting the robot. Use this for cleaning up drive train and shooter. // affecting the robot. Use this for cleaning up drive train and shooter.
// Also used for detecting changes in an axis' value. // Also used for detecting changes in an axis' value.
@ -390,37 +392,12 @@ public:
inverting = false; inverting = false;
} }
if(operator_stick.GetRawButton(4))
/*
* Unlike the previous actions, this method does need to be called every iteration of
* TeleopPeriodic. This is because the logic running this operation needs to be checked
* Every time the method is called. This cannot be a loop in the Shoot method because
* that would lock the robot every time the trigger is hit.
*/
if(operator_stick.GetRawButton(TRIGGER) || (shooter.GetState() != 0))
{ {
shooting = true; arms.Set(-operator_stick.GetY() * ARMS_SCALE);
shooter.Shoot();
} }
else if(shooting && !operator_stick.GetRawButton(TRIGGER)) else
{ {
shooting = false;
shooter.StopShooter();
}
if(!arming && driver_stick.GetRawButton(RAMP_RAISE))
{
arming = true;
arms.Set(1);
}
else if(!arming && driver_stick.GetRawButton(RAMP_LOWER))
{
arming = true;
arms.Set(-1);
}
else if(arming && !driver_stick.GetRawButton(RAMP_RAISE) && !driver_stick.GetRawButton(RAMP_LOWER))
{
arming = false;
arms.Set(0); arms.Set(0);
} }