Now has Sane pickup logic~

This commit is contained in:
Jason Cox 2016-02-13 11:26:07 -05:00
parent 2ad0f975b3
commit eccd90ea8a
2 changed files with 11 additions and 6 deletions

View File

@ -9,7 +9,7 @@
#define RAMP_RAISE 3 // Button 3 for Raising Ramp #define RAMP_RAISE 3 // Button 3 for Raising Ramp
#define RAMP_LOWER 4 // Button 4 to lower ramp. #define RAMP_LOWER 4 // Button 4 to lower ramp.
#define DEADZONE_RADIUS 0.05 // Deadzone Radius prevents tiny twitches in the joystick's value from #define DEADZONE_RADIUS 0.01 // 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.
@ -118,24 +118,28 @@ private:
// This is shit code for testing. Replace it with real code. // This is shit code for testing. Replace it with real code.
if(!ramping && operator_stick.GetRawButton(RAMP_RAISE)) if(!ramping && operator_stick.GetRawButton(RAMP_RAISE))
{ {
std::cout << "Raising Ramp.";
//launch_spinny.Set(1); //launch_spinny.Set(1);
shooter.RaiseRamp(); shooter.RaiseRamp();
ramping =true; ramping =true;
} }
else if(!ramping && operator_stick.GetRawButton(RAMP_LOWER)) else if(!ramping && operator_stick.GetRawButton(RAMP_LOWER))
{ {
std::cout << "Lowering Ramp.";
//launch_spinny.Set(-1); //launch_spinny.Set(-1);
shooter.LowerRamp(); shooter.LowerRamp();
ramping = true; ramping = true;
} }
else if(!ramping && operator_stick.GetRawButton(TRIGGER)) /*else if(!ramping && operator_stick.GetRawButton(TRIGGER))
{ {
shooter.BoostRamp(); shooter.BoostRamp();
ramping = true; ramping = true;
} }*/
else if(ramping) else if(ramping)
{ {
launch_spinny.Set(0); std::cout << "Stopping Ramp.";
shooter.StopRamp();
ramping = false;
} }
@ -182,7 +186,7 @@ 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) && !shooting) if(operator_stick.GetRawButton(TRIGGER))
{ {
shooting = true; shooting = true;
shooter.Shoot(); shooter.Shoot();

View File

@ -8,7 +8,7 @@
#ifndef SRC_SHOOTER_H_ #ifndef SRC_SHOOTER_H_
#define SRC_SHOOTER_H_ #define SRC_SHOOTER_H_
#define PICKUP_POWER 1.0 #define PICKUP_POWER 0.5
#define SPINUP_TIME 1.5 // seconds. #define SPINUP_TIME 1.5 // seconds.
class Shooter class Shooter
@ -84,6 +84,7 @@ public:
void PickUp(bool state = true) void PickUp(bool state = true)
{ {
pickup->Set((float) (state * PICKUP_POWER)); pickup->Set((float) (state * PICKUP_POWER));
launcher->Set((float) (state * PICKUP_POWER * -1));
//launch_spinny->Set(-1.0*PICKUP_POWER); //launch_spinny->Set(-1.0*PICKUP_POWER);
std::cout << "picking up!\n"; std::cout << "picking up!\n";
} }