mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00: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:
@@ -12,7 +12,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.
|
||||
@@ -62,9 +62,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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -20,7 +20,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -43,9 +43,9 @@ class Robot : public wpi::TimedRobot {
|
||||
m_controller.GetRightX());
|
||||
}
|
||||
|
||||
void TestInit() override {}
|
||||
void UtilityInit() override {}
|
||||
|
||||
void TestPeriodic() override {}
|
||||
void UtilityPeriodic() override {}
|
||||
|
||||
private:
|
||||
// Robot drive system
|
||||
|
||||
@@ -56,8 +56,8 @@ int main(void) {
|
||||
{"", 0},
|
||||
-1,
|
||||
-1},
|
||||
{HAL_MAKE_OPMODEID(HAL_ROBOT_MODE_TEST, 0),
|
||||
{"Test", 4},
|
||||
{HAL_MAKE_OPMODEID(HAL_ROBOT_MODE_UTILITY, 0),
|
||||
{"Utility", 4},
|
||||
{"", 0},
|
||||
{"", 0},
|
||||
-1,
|
||||
@@ -116,7 +116,7 @@ int main(void) {
|
||||
break;
|
||||
case HAL_ROBOT_MODE_AUTONOMOUS:
|
||||
break;
|
||||
case HAL_ROBOT_MODE_TEST:
|
||||
case HAL_ROBOT_MODE_UTILITY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -21,7 +21,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.
|
||||
@@ -70,9 +70,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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -21,7 +21,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.
|
||||
@@ -70,9 +70,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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -45,12 +45,12 @@ void Robot::TeleopInit() {
|
||||
|
||||
void Robot::TeleopPeriodic() {}
|
||||
|
||||
void Robot::TestInit() {
|
||||
// Cancels all running commands at the start of test mode.
|
||||
void Robot::UtilityInit() {
|
||||
// Cancels all running commands at the start of utility mode.
|
||||
wpi::cmd::CommandScheduler::GetInstance().CancelAll();
|
||||
}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
void Robot::UtilityPeriodic() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -20,8 +20,8 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityInit() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
RapidReactCommandBot m_robot;
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -17,7 +17,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.
|
||||
|
||||
@@ -61,9 +61,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() {}
|
||||
|
||||
#ifndef RUNNING_WPILIB_TESTS
|
||||
int main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void UtilityPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
|
||||
@@ -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