Fixed some really bad logic in the shooter...

This commit is contained in:
Jason Cox 2016-02-13 11:12:20 -05:00
parent 63f3c48267
commit ae2dfe0047
2 changed files with 25 additions and 10 deletions

View File

@ -43,6 +43,8 @@ private:
// instance variables // instance variables
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released. bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
bool inverting; bool inverting;
bool ramping;
bool shooting;
float shooter_power; float shooter_power;
LiveWindow *lw = LiveWindow::GetInstance(); LiveWindow *lw = LiveWindow::GetInstance();
@ -61,9 +63,11 @@ private:
shooter2.Enable(); shooter2.Enable();
left_drive.SetInverted(true); left_drive.SetInverted(true);
right_drive.SetInverted(true); right_drive.SetInverted(true);
launch_spinny.SetInverted(true); //launch_spinny.SetInverted(true);
inverting = false; inverting = false;
pickupRunning = false; pickupRunning = false;
ramping = false;
shooting = false;
shooter_power = 0; shooter_power = 0;
} }
@ -110,22 +114,26 @@ private:
std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl; std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl;
drive.ArcadeDrive(&driver_stick, true); drive.ArcadeDrive(&driver_stick, true);
//bool rampDoing = false;
// This is shit code for testing. Replace it with real code. // This is shit code for testing. Replace it with real code.
if(operator_stick.GetRawButton(RAMP_RAISE)) if(!ramping && operator_stick.GetRawButton(RAMP_RAISE))
{ {
//launch_spinny.Set(1); //launch_spinny.Set(1);
shooter.RaiseRamp(); shooter.RaiseRamp();
ramping =true;
} }
else if(operator_stick.GetRawButton(RAMP_LOWER)) else if(!ramping && operator_stick.GetRawButton(RAMP_LOWER))
{ {
//launch_spinny.Set(-1); //launch_spinny.Set(-1);
shooter.LowerRamp(); shooter.LowerRamp();
ramping = true;
} }
else if(operator_stick.GetRawButton(TRIGGER)) else if(!ramping && operator_stick.GetRawButton(TRIGGER))
{ {
shooter.BoostRamp(); shooter.BoostRamp();
ramping = true;
} }
else else if(ramping)
{ {
launch_spinny.Set(0); launch_spinny.Set(0);
} }
@ -174,12 +182,14 @@ private:
* Every time the method is called. This cannot be a loop in the Shoot method because * 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. * that would lock the robot every time the trigger is hit.
*/ */
if(operator_stick.GetRawButton(TRIGGER)) if(operator_stick.GetRawButton(TRIGGER) && !shooting)
{ {
shooting = true;
shooter.Shoot(); shooter.Shoot();
} }
else else if(shooting)
{ {
shooting = false;
shooter.StopShooter(); shooter.StopShooter();
} }

View File

@ -51,17 +51,22 @@ public:
void LowerRamp() void LowerRamp()
{ {
launch_spinny->Set(-0.25); launch_spinny->Set(-1);
} }
void RaiseRamp() void RaiseRamp()
{ {
launch_spinny->Set(0.25); launch_spinny->Set(1);
}
void StopRamp()
{
launch_spinny->Set(0);
} }
void BoostRamp() void BoostRamp()
{ {
launch_spinny->Set(0.5); launch_spinny->Set(1);
} }
void Shoot() void Shoot()