diff --git a/src/Robot.cpp b/src/Robot.cpp index 0a0ac59..61117ab 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -170,12 +170,10 @@ private: { shooter.BoostRamp(); ramping = true; - }*/ - else if(ramping - && !operator_stick.GetRawButton(RAMP_LOWER) - && !operator_stick.GetRawButton(RAMP_RAISE)) + } + else if(ramping && !operator_stick.GetRawButton(RAMP_RAISE) + && !operator_stick.GetRawButton(RAMP_LOWER)) { - std::cout << "Stopping Ramp."; shooter.StopRamp(); ramping = false; } @@ -213,7 +211,6 @@ private: shooter.PickUp(false); pickupRunning = false; } - /* * The 'inverting' variable is used to make sure that the drive train isn't getting * inverted every iteration of the TeleopPeriodic method while the button is held down. @@ -234,12 +231,12 @@ private: /* - * Unlike the previous actions, this method does need to be called every iteration of + * 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)) + if(operator_stick.GetRawButton(TRIGGER) || (shooter.GetState() != 0)) { shooting = true; shooter.Shoot(); diff --git a/src/Shooter.h b/src/Shooter.h index 82e4ace..5de8a86 100644 --- a/src/Shooter.h +++ b/src/Shooter.h @@ -88,21 +88,18 @@ public: } void Shoot() { - // TODO: Shooter Logic should go as follows: - - /* - Assuming a ball is held in the shooter. When the trigger is pulled, - the launch-spinny should be STOPPED. Start a Timer object counting - When... too hard to write.. I emailed you a flow chart. - */ + if (shotClock.Get() > (SPINUP_TIME + 0.1)) + { + state = RESETTING; + } switch (state) { case READY: { state = SPINNINGUP; ramp->Set(-1); - launcher->Set(PICKUP_POWER); - pickup->Set(PICKUP_POWER); + launcher->Set(LAUNCH_POWER); + pickup->Set(LAUNCH_POWER); shotClock.Reset(); shotClock.Start(); break; @@ -116,13 +113,13 @@ public: shotClock.Start(); } else { - std::cout << "*Goku noises*\n"; + //std::cout << "*Goku noises*\n"; } break; } case LAUNCH: { - ramp->Set(1); + ramp->Set(LAUNCH_POWER); state = LAUNCHING; break; } @@ -155,8 +152,7 @@ public: void PickUp(bool state = true) { pickup->Set((float) (state * PICKUP_POWER)); - launcher->Set((float) (state * PICKUP_POWER * -0.75)); - //ramp->Set(-1.0*PICKUP_POWER); + launcher->Set((float) (state * PICKUP_POWER * -1)); //std::cout << "picking up!\n"; } @@ -165,7 +161,7 @@ public: */ void Unjam() { - pickup->Set(PICKUP_POWER * -0.75); + pickup->Set(-1 * PICKUP_POWER); } void ShootLow() @@ -179,6 +175,11 @@ public: launcher->Set(power); //std::cout << "setting shooter power" << std::endl; } + + int GetState() + { + return state; + } private: //RobotDrive *shooterDrive;