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

View File

@ -20,7 +20,7 @@ class Robot: public IterativeRobot
{
Talon left_drive, right_drive;
CANTalon shooter1, shooter2,
launch_spinny;
ramp;
RobotDrive drive;
Shooter shooter;
Joystick driver_stick, operator_stick;
@ -30,10 +30,10 @@ public:
right_drive(1), // Right DriveTrain Talons plug // left wheel 2
shooter1(11), // shooter drive 1
shooter2(10), // shooter drive 2
launch_spinny(12),
ramp(12),
drive(&left_drive, &right_drive),
shooter( // initialize Shooter object.
&shooter1, &shooter2, &launch_spinny),
&shooter1, &shooter2, &ramp),
driver_stick(0), // right stick (operator)
operator_stick(1) // left stick (driver)
{
@ -65,7 +65,7 @@ private:
shooter2.Enable();
left_drive.SetInverted(true);
right_drive.SetInverted(true);
//launch_spinny.SetInverted(true);
//ramp.SetInverted(true);
inverting = false;
pickupRunning = false;
ramping = false;
@ -114,7 +114,7 @@ private:
void TeleopPeriodic()
{
//std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl;
//std::cout << "Ramp position: "<< ramp.GetEncPosition() << std::endl;
drive.ArcadeDrive(&driver_stick, true);
//bool rampDoing = false;
@ -122,7 +122,7 @@ private:
if(operator_stick.GetRawButton(RAMP_LOWER))
{
std::cout << "Lowering Ramp.";
//launch_spinny.Set(-1);
//ramp.Set(-1);
shooter.LowerRamp();
ramping = true;
}
@ -133,7 +133,7 @@ private:
}*/
else if(ramping
&& !operator_stick.GetRawButton(RAMP_LOWER)
&& launch_spinny.GetForwardLimitOK())
&& ramp.GetForwardLimitOK())
{
shooter.RaiseRamp();
}
@ -172,9 +172,9 @@ private:
shooter.PickUp(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
* 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.

View File

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