[templates] Add SimulationInit()/SimulationPeriodic() to robot templates (#3943)

This commit is contained in:
modelmat
2022-01-22 00:23:46 +00:00
committed by GitHub
parent 02a0ced9b0
commit 78d0bcf49d
9 changed files with 46 additions and 0 deletions

View File

@@ -65,6 +65,16 @@ void Robot::TeleopPeriodic() {}
*/
void Robot::TestPeriodic() {}
/**
* This function is called once when the robot is first started up.
*/
void Robot::SimulationInit() {}
/**
* This function is called periodically whilst in simulation.
*/
void Robot::SimulationPeriodic() {}
#ifndef RUNNING_FRC_TESTS
int main() {
return frc::StartRobot<Robot>();

View File

@@ -20,6 +20,8 @@ class Robot : public frc::TimedRobot {
void TeleopInit() override;
void TeleopPeriodic() override;
void TestPeriodic() override;
void SimulationInit() override;
void SimulationPeriodic() override;
private:
// Have it null by default so that if testing teleop it

View File

@@ -68,6 +68,10 @@ void Robot::TestInit() {}
void Robot::TestPeriodic() {}
void Robot::SimulationInit() {}
void Robot::SimulationPeriodic() {}
#ifndef RUNNING_FRC_TESTS
int main() {
return frc::StartRobot<Robot>();

View File

@@ -21,6 +21,8 @@ class Robot : public frc::TimedRobot {
void DisabledPeriodic() override;
void TestInit() override;
void TestPeriodic() override;
void SimulationInit() override;
void SimulationPeriodic() override;
private:
frc::SendableChooser<std::string> m_chooser;

View File

@@ -19,6 +19,9 @@ void Robot::DisabledPeriodic() {}
void Robot::TestInit() {}
void Robot::TestPeriodic() {}
void Robot::SimulationInit() {}
void Robot::SimulationPeriodic() {}
#ifndef RUNNING_FRC_TESTS
int main() {
return frc::StartRobot<Robot>();

View File

@@ -22,4 +22,7 @@ class Robot : public frc::TimedRobot {
void TestInit() override;
void TestPeriodic() override;
void SimulationInit() override;
void SimulationPeriodic() override;
};