Fixed some really bad logic in the shooter...

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

View File

@ -43,6 +43,8 @@ private:
// 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 inverting;
bool ramping;
bool shooting;
float shooter_power;
LiveWindow *lw = LiveWindow::GetInstance();
@ -61,9 +63,11 @@ private:
shooter2.Enable();
left_drive.SetInverted(true);
right_drive.SetInverted(true);
launch_spinny.SetInverted(true);
//launch_spinny.SetInverted(true);
inverting = false;
pickupRunning = false;
ramping = false;
shooting = false;
shooter_power = 0;
}
@ -110,22 +114,26 @@ private:
std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl;
drive.ArcadeDrive(&driver_stick, true);
//bool rampDoing = false;
// 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);
shooter.RaiseRamp();
ramping =true;
}
else if(operator_stick.GetRawButton(RAMP_LOWER))
else if(!ramping && operator_stick.GetRawButton(RAMP_LOWER))
{
//launch_spinny.Set(-1);
shooter.LowerRamp();
ramping = true;
}
else if(operator_stick.GetRawButton(TRIGGER))
else if(!ramping && operator_stick.GetRawButton(TRIGGER))
{
shooter.BoostRamp();
ramping = true;
}
else
else if(ramping)
{
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
* 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();
}
else
else if(shooting)
{
shooting = false;
shooter.StopShooter();
}

View File

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