purged the concept of a ramp

This commit is contained in:
Aidan Ferguson 2016-02-11 16:51:13 -05:00
parent 21f26a8907
commit 8c91ac34db
2 changed files with 6 additions and 67 deletions

View File

@ -53,12 +53,12 @@ private:
chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault); chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault);
chooser->AddObject(autoNameCustom, (void*)&autoNameCustom); chooser->AddObject(autoNameCustom, (void*)&autoNameCustom);
SmartDashboard::PutData("Auto Modes", chooser); SmartDashboard::PutData("Auto Modes", chooser);
ramp.Enable();
shooter1.Enable(); shooter1.Enable();
shooter2.Enable(); shooter2.Enable();
left_drive.SetInverted(true); left_drive.SetInverted(true);
right_drive.SetInverted(true); right_drive.SetInverted(true);
inverting = false; inverting = false;
shooter_power = 0;
} }
@ -74,9 +74,6 @@ private:
*/ */
void AutonomousInit() void AutonomousInit()
{ {
shooter.CalibrateRamp();
shooter.SetRamp(Shoot);
autoSelected = *((std::string*)chooser->GetSelected()); autoSelected = *((std::string*)chooser->GetSelected());
//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault); //std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
std::cout << "Auto selected: " << autoSelected << std::endl; std::cout << "Auto selected: " << autoSelected << std::endl;
@ -99,9 +96,7 @@ private:
void TeleopInit() void TeleopInit()
{ {
shooter.CalibrateRamp();
shooter.SetRamp(Shoot); // start in the full up position!
power = 0;
} }
void TeleopPeriodic() void TeleopPeriodic()

View File

@ -9,28 +9,11 @@
#define SRC_SHOOTER_H_ #define SRC_SHOOTER_H_
#define PICKUP_POWER 0.8 #define PICKUP_POWER 0.8
#define RAMP_LOWER_DURATION 2 //Rotations.
/**
* You can use the values assigned to each of these values as the number
* of rotations to run the motor down from the "Shoot" position.
*
* This might not be the best way to do it, and also requires that we
* figure out how to read the Hall Effect signal from the motor.
*/
enum RampState {
Shoot = 0, // 0 rotations
Half = (RAMP_LOWER_DURATION / 2), // 1 rotation?
Down = RAMP_LOWER_DURATION, // 2 rotations?
Uncalibrated = -1,
Transitioning = -2
};
class Shooter { class Shooter {
public: public:
/** /**
* Shooter talons and ramp talon. * Shooter talons and launch-spinny talon.
* s2 is also for the pickup-mechanism and can be controlled independently. * s2 is also for the pickup-mechanism and can be controlled independently.
* *
*/ */
@ -38,25 +21,18 @@ public:
// shooterDrive = new RobotDrive(s1, s2); // shooterDrive = new RobotDrive(s1, s2);
launcher = s1; launcher = s1;
pickup = s2; pickup = s2;
ramp = r; launch_spinny = r;
rampState = Uncalibrated;
} }
/** /**
* Call this method on TeleopInit so that the ramp is properly * Call this method on TeleopInit so that the ramp is properly
* set at the beginning of the match. * set at the beginning of the match.
*/ */
RampState CalibrateRamp() {
// TODO:
// Ramp no longer exists, replace with more wheels.
return Down;
}
virtual ~Shooter() { virtual ~Shooter() {
delete launcher; delete launcher;
delete pickup; delete pickup;
delete ramp; delete launch_spinny;
} }
void PickUp(bool state = true) { void PickUp(bool state = true) {
@ -64,34 +40,6 @@ public:
std::cout << "picking up!\n"; std::cout << "picking up!\n";
} }
void SetRamp(RampState state) {
// TODO:
// Move the Ramp to the set position.
switch (state)
{
case Shoot:
{
if (ramp->GetForwardLimitOK())
{
ramp->Set(1);
} else
{
ramp->Set(0);
}
}
case Half:
{
//yeah, put something here when you get the encoder working.
std::cout << "Hey! Didja install an encoder? Because this is placeholder that Aidan would have removed if you had installed one and told him about it.\n";
}
case Down:
{
//see half.
std::cout << "Hey! Didja install an encoder? Because this is placeholder that Aidan would have removed if you had installed one and told him about it.\n";
}
}
}
/** /**
* Call this to run the pickup backwards if the ball gets jammed somehow... * Call this to run the pickup backwards if the ball gets jammed somehow...
*/ */
@ -110,11 +58,7 @@ private:
RobotDrive *shooterDrive; RobotDrive *shooterDrive;
CANTalon *launcher; CANTalon *launcher;
CANTalon *pickup; CANTalon *pickup;
CANTalon *ramp; CANTalon *launch_spinny;
RampState rampState;
RampState targetState;
RampState previousState;
}; };
#endif /* SRC_SHOOTER_H_ */ #endif /* SRC_SHOOTER_H_ */