mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick find and replace to do. Basically, there are two primary things that we have done this summer that break existing user code: -Changing GetInstance() calls to return references instead of pointers. This forces users to change from doing something like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor(). -Making PIDGet() and related calls const, forcing users to change the function signatures wherever they override them. The GetInstance() calls don't really matter to me either way, especially since there are no real ownership issues going on there, unlike the rest of the smart pointer-related changes. For the const stuff, it is certainly more correct to mandate that user PIDGet() functions be const and the such, but at the same time, I'm not sure that there is any strong need for it, and the errors generated are not the most helpful. While this wouldn't necessarily be an issue for more experienced teams or completely new teams (who don't have any old code to be reusing), it may cause issues for more average teams who aren't familiar with the intricacies of C++ anything. Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
This commit is contained in:
@@ -39,7 +39,7 @@ void Robot::AutonomousInit() {
|
||||
}
|
||||
|
||||
void Robot::AutonomousPeriodic() {
|
||||
Scheduler::GetInstance().Run();
|
||||
Scheduler::GetInstance()->Run();
|
||||
Log();
|
||||
}
|
||||
|
||||
@@ -55,12 +55,12 @@ void Robot::TeleopInit() {
|
||||
}
|
||||
|
||||
void Robot::TeleopPeriodic() {
|
||||
Scheduler::GetInstance().Run();
|
||||
Scheduler::GetInstance()->Run();
|
||||
Log();
|
||||
}
|
||||
|
||||
void Robot::TestPeriodic() {
|
||||
LiveWindow::GetInstance().Run();
|
||||
LiveWindow::GetInstance()->Run();
|
||||
}
|
||||
|
||||
void Robot::DisabledInit() {
|
||||
|
||||
@@ -11,9 +11,9 @@ Collector::Collector() :
|
||||
|
||||
// Put everything to the LiveWindow for testing.
|
||||
// XXX: LiveWindow::GetInstance()->AddActuator("Collector", "Roller Motor", (Victor) rollerMotor);
|
||||
LiveWindow::GetInstance().AddSensor("Collector", "Ball Detector", ballDetector);
|
||||
LiveWindow::GetInstance().AddSensor("Collector", "Claw Open Detector", openDetector);
|
||||
LiveWindow::GetInstance().AddActuator("Collector", "Piston", piston);
|
||||
LiveWindow::GetInstance()->AddSensor("Collector", "Ball Detector", ballDetector);
|
||||
LiveWindow::GetInstance()->AddSensor("Collector", "Claw Open Detector", openDetector);
|
||||
LiveWindow::GetInstance()->AddActuator("Collector", "Piston", piston);
|
||||
}
|
||||
|
||||
bool Collector::HasBall() {
|
||||
|
||||
@@ -44,14 +44,14 @@ DriveTrain::DriveTrain()
|
||||
leftEncoder->SetDistancePerPulse((4.0/*in*/*M_PI)/(360.0*12.0/*in/ft*/));
|
||||
#endif
|
||||
|
||||
LiveWindow::GetInstance().AddSensor("DriveTrain", "Right Encoder", rightEncoder);
|
||||
LiveWindow::GetInstance().AddSensor("DriveTrain", "Left Encoder", leftEncoder);
|
||||
LiveWindow::GetInstance()->AddSensor("DriveTrain", "Right Encoder", rightEncoder);
|
||||
LiveWindow::GetInstance()->AddSensor("DriveTrain", "Left Encoder", leftEncoder);
|
||||
|
||||
// Configure gyro
|
||||
#ifdef REAL
|
||||
gyro->SetSensitivity(0.007); // TODO: Handle more gracefully?
|
||||
#endif
|
||||
LiveWindow::GetInstance().AddSensor("DriveTrain", "Gyro", gyro);
|
||||
LiveWindow::GetInstance()->AddSensor("DriveTrain", "Gyro", gyro);
|
||||
}
|
||||
|
||||
void DriveTrain::InitDefaultCommand() {
|
||||
|
||||
@@ -20,16 +20,16 @@ Pivot::Pivot() :
|
||||
#endif
|
||||
|
||||
// Put everything to the LiveWindow for testing.
|
||||
LiveWindow::GetInstance().AddSensor("Pivot", "Upper Limit Switch", upperLimitSwitch);
|
||||
LiveWindow::GetInstance().AddSensor("Pivot", "Lower Limit Switch", lowerLimitSwitch);
|
||||
// XXX: LiveWindow::GetInstance().AddSensor("Pivot", "Pot", (AnalogPotentiometer) pot);
|
||||
// XXX: LiveWindow::GetInstance().AddActuator("Pivot", "Motor", (Victor) motor);
|
||||
LiveWindow::GetInstance().AddActuator("Pivot", "PIDSubsystem Controller", GetPIDController());
|
||||
LiveWindow::GetInstance()->AddSensor("Pivot", "Upper Limit Switch", upperLimitSwitch);
|
||||
LiveWindow::GetInstance()->AddSensor("Pivot", "Lower Limit Switch", lowerLimitSwitch);
|
||||
// XXX: LiveWindow::GetInstance()->AddSensor("Pivot", "Pot", (AnalogPotentiometer) pot);
|
||||
// XXX: LiveWindow::GetInstance()->AddActuator("Pivot", "Motor", (Victor) motor);
|
||||
LiveWindow::GetInstance()->AddActuator("Pivot", "PIDSubsystem Controller", GetPIDController());
|
||||
}
|
||||
|
||||
void InitDefaultCommand() {}
|
||||
|
||||
double Pivot::ReturnPIDInput() const {
|
||||
double Pivot::ReturnPIDInput() {
|
||||
return pot->Get();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
/**
|
||||
* @return The angle read in by the potentiometer
|
||||
*/
|
||||
double ReturnPIDInput() const;
|
||||
double ReturnPIDInput();
|
||||
|
||||
/**
|
||||
* Set the motor speed based off of the PID output
|
||||
|
||||
@@ -8,7 +8,7 @@ Pneumatics::Pneumatics() :
|
||||
compressor = new Compressor(uint8_t(1)); // TODO: (1, 14, 1, 8);
|
||||
#endif
|
||||
|
||||
LiveWindow::GetInstance().AddSensor("Pneumatics", "Pressure Sensor", pressureSensor);
|
||||
LiveWindow::GetInstance()->AddSensor("Pneumatics", "Pressure Sensor", pressureSensor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,10 +12,10 @@ Shooter::Shooter() :
|
||||
{
|
||||
|
||||
// Put everything to the LiveWindow for testing.
|
||||
LiveWindow::GetInstance().AddSensor("Shooter", "Hot Goal Sensor", hotGoalSensor);
|
||||
LiveWindow::GetInstance().AddSensor("Shooter", "Piston1 Reed Switch Front ", piston1ReedSwitchFront);
|
||||
LiveWindow::GetInstance().AddSensor("Shooter", "Piston1 Reed Switch Back ", piston1ReedSwitchBack);
|
||||
LiveWindow::GetInstance().AddActuator("Shooter", "Latch Piston", latchPiston);
|
||||
LiveWindow::GetInstance()->AddSensor("Shooter", "Hot Goal Sensor", hotGoalSensor);
|
||||
LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Front ", piston1ReedSwitchFront);
|
||||
LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Back ", piston1ReedSwitchBack);
|
||||
LiveWindow::GetInstance()->AddActuator("Shooter", "Latch Piston", latchPiston);
|
||||
}
|
||||
|
||||
void Shooter::InitDefaultCommand()
|
||||
|
||||
Reference in New Issue
Block a user