diff --git a/Robot2016/src/Robot.cpp b/Robot2016/src/Robot.cpp index 6ec1e54..6dd945d 100644 --- a/Robot2016/src/Robot.cpp +++ b/Robot2016/src/Robot.cpp @@ -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(); } diff --git a/Robot2016/src/Shooter.h b/Robot2016/src/Shooter.h index 7b4705d..8dbdc57 100644 --- a/Robot2016/src/Shooter.h +++ b/Robot2016/src/Shooter.h @@ -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()