mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[hal,wpilib] Rename "Test" robot mode to "Utility" (#8782)
The "Utility" name better matches its intended generic use case and avoids overloaded terminology with unit testing (e.g. the need to name the opmode annotation `@TestOpMode`). The driver station will also be updated to reflect this change.
This commit is contained in:
@@ -11,7 +11,7 @@ Robot::Robot() {}
|
||||
/**
|
||||
* This function is called every 20 ms, no matter the mode. Use
|
||||
* this for items like diagnostics that you want to run during disabled,
|
||||
* autonomous, teleoperated and test.
|
||||
* autonomous, teleoperated and utility.
|
||||
*
|
||||
* <p> This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
@@ -60,9 +60,9 @@ void Robot::TeleopInit() {
|
||||
void Robot::TeleopPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
* This function is called periodically during utility mode.
|
||||
*/
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once when the robot is first started up.
|
||||
|
||||
@@ -20,7 +20,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
void SimulationInit() override;
|
||||
void SimulationPeriodic() override;
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ void Robot::TeleopPeriodic() {}
|
||||
|
||||
void Robot::TeleopExit() {}
|
||||
|
||||
void Robot::TestInit() {
|
||||
void Robot::UtilityInit() {
|
||||
wpi::cmd::CommandScheduler::GetInstance().CancelAll();
|
||||
}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
void Robot::TestExit() {}
|
||||
void Robot::UtilityExit() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -23,9 +23,9 @@ class Robot : public wpi::TimedRobot {
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TeleopExit() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void TestExit() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
void UtilityExit() override;
|
||||
|
||||
private:
|
||||
std::optional<wpi::cmd::CommandPtr> m_autonomousCommand;
|
||||
|
||||
@@ -17,7 +17,7 @@ void Robot::Autonomous() {}
|
||||
|
||||
void Robot::Teleop() {}
|
||||
|
||||
void Robot::Test() {}
|
||||
void Robot::Utility() {}
|
||||
|
||||
void Robot::StartCompetition() {
|
||||
wpi::internal::DriverStationModeThread modeThread{wpi::hal::GetControlWord()};
|
||||
@@ -25,7 +25,7 @@ void Robot::StartCompetition() {
|
||||
// Create an opmode per robot mode
|
||||
wpi::RobotState::AddOpMode(wpi::RobotMode::AUTONOMOUS, "Auto");
|
||||
wpi::RobotState::AddOpMode(wpi::RobotMode::TELEOPERATED, "Teleop");
|
||||
wpi::RobotState::AddOpMode(wpi::RobotMode::TEST, "Test");
|
||||
wpi::RobotState::AddOpMode(wpi::RobotMode::UTILITY, "Utility");
|
||||
wpi::RobotState::PublishOpModes();
|
||||
|
||||
wpi::util::Event event{false, false};
|
||||
@@ -47,9 +47,9 @@ void Robot::StartCompetition() {
|
||||
while (IsAutonomousEnabled()) {
|
||||
wpi::util::WaitForObject(event.GetHandle());
|
||||
}
|
||||
} else if (IsTest()) {
|
||||
Test();
|
||||
while (IsTest() && IsEnabled()) {
|
||||
} else if (IsUtility()) {
|
||||
Utility();
|
||||
while (IsUtility() && IsEnabled()) {
|
||||
wpi::util::WaitForObject(event.GetHandle());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -14,7 +14,7 @@ class Robot : public wpi::RobotBase {
|
||||
void Disabled();
|
||||
void Autonomous();
|
||||
void Teleop();
|
||||
void Test();
|
||||
void Utility();
|
||||
|
||||
void StartCompetition() override;
|
||||
void EndCompetition() override;
|
||||
|
||||
@@ -16,7 +16,7 @@ Robot::Robot() {
|
||||
/**
|
||||
* This function is called every 20 ms, no matter the mode. Use
|
||||
* this for items like diagnostics that you want ran during disabled,
|
||||
* autonomous, teleoperated and test.
|
||||
* autonomous, teleoperated and utility.
|
||||
*
|
||||
* <p> This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
@@ -63,9 +63,9 @@ void Robot::DisabledInit() {}
|
||||
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::TestInit() {}
|
||||
void Robot::UtilityInit() {}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
void Robot::SimulationInit() {}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ class Robot : public wpi::TimedRobot {
|
||||
void TeleopPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
void SimulationInit() override;
|
||||
void SimulationPeriodic() override;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ void Robot::TeleopPeriodic() {}
|
||||
void Robot::DisabledInit() {}
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::TestInit() {}
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityInit() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
void Robot::SimulationInit() {}
|
||||
void Robot::SimulationPeriodic() {}
|
||||
|
||||
@@ -20,8 +20,8 @@ class Robot : public wpi::TimedRobot {
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
void SimulationInit() override;
|
||||
void SimulationPeriodic() override;
|
||||
|
||||
@@ -74,9 +74,9 @@ void Robot::DisabledInit() {}
|
||||
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::TestInit() {}
|
||||
void Robot::UtilityInit() {}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -19,8 +19,8 @@ class Robot : public wpi::TimesliceRobot {
|
||||
void TeleopPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
wpi::SendableChooser<std::string> m_chooser;
|
||||
|
||||
@@ -28,8 +28,8 @@ void Robot::TeleopPeriodic() {}
|
||||
void Robot::DisabledInit() {}
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::TestInit() {}
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityInit() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -21,6 +21,6 @@ class Robot : public wpi::TimesliceRobot {
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user