Merge branch 'shooter' into release

# Conflicts:
#	Robot2016/src/Robot.cpp
#	Robot2016/src/Shooter.h
This commit is contained in:
dkbug 2016-02-27 13:24:39 -05:00
commit d90d6b9a79
2 changed files with 20 additions and 22 deletions

View File

@ -170,12 +170,10 @@ private:
{ {
shooter.BoostRamp(); shooter.BoostRamp();
ramping = true; ramping = true;
}*/ }
else if(ramping else if(ramping && !operator_stick.GetRawButton(RAMP_RAISE)
&& !operator_stick.GetRawButton(RAMP_LOWER) && !operator_stick.GetRawButton(RAMP_LOWER))
&& !operator_stick.GetRawButton(RAMP_RAISE))
{ {
std::cout << "Stopping Ramp.";
shooter.StopRamp(); shooter.StopRamp();
ramping = false; ramping = false;
} }
@ -213,7 +211,6 @@ private:
shooter.PickUp(false); shooter.PickUp(false);
pickupRunning = false; pickupRunning = false;
} }
/* /*
* The 'inverting' variable is used to make sure that the drive train isn't getting * 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. * inverted every iteration of the TeleopPeriodic method while the button is held down.
@ -239,7 +236,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)) if(operator_stick.GetRawButton(TRIGGER) || (shooter.GetState() != 0))
{ {
shooting = true; shooting = true;
shooter.Shoot(); shooter.Shoot();

View File

@ -88,21 +88,18 @@ public:
} }
void Shoot() void Shoot()
{ {
// TODO: Shooter Logic should go as follows: if (shotClock.Get() > (SPINUP_TIME + 0.1))
{
/* state = RESETTING;
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.
*/
switch (state) switch (state)
{ {
case READY: case READY:
{ {
state = SPINNINGUP; state = SPINNINGUP;
ramp->Set(-1); ramp->Set(-1);
launcher->Set(PICKUP_POWER); launcher->Set(LAUNCH_POWER);
pickup->Set(PICKUP_POWER); pickup->Set(LAUNCH_POWER);
shotClock.Reset(); shotClock.Reset();
shotClock.Start(); shotClock.Start();
break; break;
@ -116,13 +113,13 @@ public:
shotClock.Start(); shotClock.Start();
} else } else
{ {
std::cout << "*Goku noises*\n"; //std::cout << "*Goku noises*\n";
} }
break; break;
} }
case LAUNCH: case LAUNCH:
{ {
ramp->Set(1); ramp->Set(LAUNCH_POWER);
state = LAUNCHING; state = LAUNCHING;
break; break;
} }
@ -155,8 +152,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 * -0.75)); launcher->Set((float) (state * PICKUP_POWER * -1));
//ramp->Set(-1.0*PICKUP_POWER);
//std::cout << "picking up!\n"; //std::cout << "picking up!\n";
} }
@ -165,7 +161,7 @@ public:
*/ */
void Unjam() void Unjam()
{ {
pickup->Set(PICKUP_POWER * -0.75); pickup->Set(-1 * PICKUP_POWER);
} }
void ShootLow() void ShootLow()
@ -179,6 +175,11 @@ public:
launcher->Set(power); launcher->Set(power);
//std::cout << "setting shooter power" << std::endl; //std::cout << "setting shooter power" << std::endl;
} }
int GetState()
{
return state;
}
private: private:
//RobotDrive *shooterDrive; //RobotDrive *shooterDrive;