This commit is contained in:
Aidan Ferguson 2016-02-20 14:05:01 -05:00
parent 0c67d00109
commit f5bdcf7553
2 changed files with 24 additions and 25 deletions

View File

@ -20,7 +20,7 @@ class Robot: public IterativeRobot
{ {
Talon left_drive, right_drive; Talon left_drive, right_drive;
CANTalon shooter1, shooter2, CANTalon shooter1, shooter2,
launch_spinny; ramp;
RobotDrive drive; RobotDrive drive;
Shooter shooter; Shooter shooter;
Joystick driver_stick, operator_stick; Joystick driver_stick, operator_stick;
@ -30,10 +30,10 @@ public:
right_drive(1), // Right DriveTrain Talons plug // left wheel 2 right_drive(1), // Right DriveTrain Talons plug // left wheel 2
shooter1(11), // shooter drive 1 shooter1(11), // shooter drive 1
shooter2(10), // shooter drive 2 shooter2(10), // shooter drive 2
launch_spinny(12), ramp(12),
drive(&left_drive, &right_drive), drive(&left_drive, &right_drive),
shooter( // initialize Shooter object. shooter( // initialize Shooter object.
&shooter1, &shooter2, &launch_spinny), &shooter1, &shooter2, &ramp),
driver_stick(0), // right stick (operator) driver_stick(0), // right stick (operator)
operator_stick(1) // left stick (driver) operator_stick(1) // left stick (driver)
{ {
@ -65,7 +65,7 @@ private:
shooter2.Enable(); shooter2.Enable();
left_drive.SetInverted(true); left_drive.SetInverted(true);
right_drive.SetInverted(true); right_drive.SetInverted(true);
//launch_spinny.SetInverted(true); //ramp.SetInverted(true);
inverting = false; inverting = false;
pickupRunning = false; pickupRunning = false;
ramping = false; ramping = false;
@ -114,7 +114,7 @@ private:
void TeleopPeriodic() void TeleopPeriodic()
{ {
//std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl; //std::cout << "Ramp position: "<< ramp.GetEncPosition() << std::endl;
drive.ArcadeDrive(&driver_stick, true); drive.ArcadeDrive(&driver_stick, true);
//bool rampDoing = false; //bool rampDoing = false;
@ -122,7 +122,7 @@ private:
if(operator_stick.GetRawButton(RAMP_LOWER)) if(operator_stick.GetRawButton(RAMP_LOWER))
{ {
std::cout << "Lowering Ramp."; std::cout << "Lowering Ramp.";
//launch_spinny.Set(-1); //ramp.Set(-1);
shooter.LowerRamp(); shooter.LowerRamp();
ramping = true; ramping = true;
} }
@ -133,7 +133,7 @@ private:
}*/ }*/
else if(ramping else if(ramping
&& !operator_stick.GetRawButton(RAMP_LOWER) && !operator_stick.GetRawButton(RAMP_LOWER)
&& launch_spinny.GetForwardLimitOK()) && ramp.GetForwardLimitOK())
{ {
shooter.RaiseRamp(); shooter.RaiseRamp();
} }
@ -172,9 +172,9 @@ private:
shooter.PickUp(false); shooter.PickUp(false);
pickupRunning = false; pickupRunning = false;
} }
else if(launch_spinny.Get() != 1) else if(ramp.Get() != 1)
{ {
launch_spinny.Set(1); ramp.Set(1);
} }
/* /*
@ -197,7 +197,6 @@ private:
/* /*
* Unlike the previous actions, this method does need to be called every itteration of
* TeleopPeriodic. This is because the logic running this operation needs to be checked * 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 * 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.

View File

@ -37,7 +37,7 @@ public:
// shooterDrive = new RobotDrive(s1, s2); // shooterDrive = new RobotDrive(s1, s2);
launcher = s1; launcher = s1;
pickup = s2; pickup = s2;
launch_spinny = r; ramp = r;
ready = true; ready = true;
state = READY; state = READY;
} }
@ -51,37 +51,37 @@ public:
{ {
delete launcher; delete launcher;
delete pickup; delete pickup;
delete launch_spinny; delete ramp;
} }
void StopShooter() void StopShooter()
{ {
ready = true; ready = true;
launch_spinny->Set(0); ramp->Set(0);
launcher->Set(0); launcher->Set(0);
pickup->Set(0); pickup->Set(0);
} }
void LowerRamp() void LowerRamp()
{ {
if(launch_spinny->GetReverseLimitOK()) if(ramp->GetReverseLimitOK())
launch_spinny->Set(-1); ramp->Set(-1);
} }
void RaiseRamp() void RaiseRamp()
{ {
if(launch_spinny->GetForwardLimitOK()) if(ramp->GetForwardLimitOK())
launch_spinny->Set(1); ramp->Set(1);
} }
void StopRamp() void StopRamp()
{ {
launch_spinny->Set(0); ramp->Set(0);
} }
void BoostRamp() void BoostRamp()
{ {
launch_spinny->Set(1); ramp->Set(1);
} }
void Shoot() void Shoot()
@ -95,7 +95,7 @@ public:
case READY: case READY:
{ {
state = SPINNINGUP; state = SPINNINGUP;
launch_spinny->Set(-1); ramp->Set(-1);
launcher->Set(LAUNCH_POWER); launcher->Set(LAUNCH_POWER);
pickup->Set(LAUNCH_POWER); pickup->Set(LAUNCH_POWER);
shotClock.Reset(); shotClock.Reset();
@ -117,7 +117,7 @@ public:
} }
case LAUNCH: case LAUNCH:
{ {
launch_spinny->Set(LAUNCH_POWER); ramp->Set(LAUNCH_POWER);
state = LAUNCHING; state = LAUNCHING;
break; break;
} }
@ -132,7 +132,7 @@ public:
} }
case RESETTING: case RESETTING:
{ {
launch_spinny->Set(0); ramp->Set(0);
launcher->Set(0); launcher->Set(0);
pickup->Set(0); pickup->Set(0);
state = READY; state = READY;
@ -153,10 +153,10 @@ public:
launcher->Set((float) (state * PICKUP_POWER * -1)); launcher->Set((float) (state * PICKUP_POWER * -1));
if (state) if (state)
{ {
launch_spinny->Set(-1.0); ramp->Set(-1.0);
} else } else
{ {
launch_spinny->Set(1); ramp->Set(1);
} }
//std::cout << "picking up!\n"; //std::cout << "picking up!\n";
} }
@ -185,7 +185,7 @@ private:
//RobotDrive *shooterDrive; //RobotDrive *shooterDrive;
CANTalon *launcher; CANTalon *launcher;
CANTalon *pickup; CANTalon *pickup;
CANTalon *launch_spinny; CANTalon *ramp;
ShooterState state; ShooterState state;
Timer shotClock; Timer shotClock;