mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +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:
@@ -99,13 +99,13 @@ struct DashboardOpModeInstance {
|
||||
void Start(nt::NetworkTableInstance inst) {
|
||||
autoOpModes.Start(inst, "/SmartDashboard/Auto OpMode");
|
||||
teleopOpModes.Start(inst, "/SmartDashboard/Teleop OpMode");
|
||||
testOpModes.Start(inst, "/SmartDashboard/Test OpMode");
|
||||
utilityOpModes.Start(inst, "/SmartDashboard/Utility OpMode");
|
||||
}
|
||||
|
||||
util::mutex mutex;
|
||||
DashboardOpModeSender autoOpModes;
|
||||
DashboardOpModeSender teleopOpModes;
|
||||
DashboardOpModeSender testOpModes;
|
||||
DashboardOpModeSender utilityOpModes;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -122,7 +122,7 @@ void hal::SetDashboardOpModeOptions(std::span<const HAL_OpModeOption> options) {
|
||||
std::scoped_lock lock{gInstance->mutex};
|
||||
gInstance->autoOpModes.SetOptions(options, HAL_ROBOT_MODE_AUTONOMOUS);
|
||||
gInstance->teleopOpModes.SetOptions(options, HAL_ROBOT_MODE_TELEOPERATED);
|
||||
gInstance->testOpModes.SetOptions(options, HAL_ROBOT_MODE_TEST);
|
||||
gInstance->utilityOpModes.SetOptions(options, HAL_ROBOT_MODE_UTILITY);
|
||||
}
|
||||
|
||||
void hal::StartDashboardOpMode() {
|
||||
@@ -141,7 +141,7 @@ void hal::EnableDashboardOpMode() {
|
||||
std::scoped_lock lock{gInstance->mutex};
|
||||
gInstance->autoOpModes.Enable();
|
||||
gInstance->teleopOpModes.Enable();
|
||||
gInstance->testOpModes.Enable();
|
||||
gInstance->utilityOpModes.Enable();
|
||||
}
|
||||
|
||||
int64_t hal::GetDashboardSelectedOpMode(HAL_RobotMode robotMode) {
|
||||
@@ -154,8 +154,8 @@ int64_t hal::GetDashboardSelectedOpMode(HAL_RobotMode robotMode) {
|
||||
return gInstance->autoOpModes.GetSelected();
|
||||
case HAL_ROBOT_MODE_TELEOPERATED:
|
||||
return gInstance->teleopOpModes.GetSelected();
|
||||
case HAL_ROBOT_MODE_TEST:
|
||||
return gInstance->testOpModes.GetSelected();
|
||||
case HAL_ROBOT_MODE_UTILITY:
|
||||
return gInstance->utilityOpModes.GetSelected();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ HAL_ENUM(HAL_RobotMode) {
|
||||
HAL_ROBOT_MODE_UNKNOWN = 0,
|
||||
HAL_ROBOT_MODE_AUTONOMOUS,
|
||||
HAL_ROBOT_MODE_TELEOPERATED,
|
||||
HAL_ROBOT_MODE_TEST,
|
||||
HAL_ROBOT_MODE_UTILITY,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,8 +19,8 @@ enum class RobotMode {
|
||||
AUTONOMOUS = HAL_ROBOT_MODE_AUTONOMOUS,
|
||||
/// Teleoperated.
|
||||
TELEOPERATED = HAL_ROBOT_MODE_TELEOPERATED,
|
||||
/// Test.
|
||||
TEST = HAL_ROBOT_MODE_TEST
|
||||
/// Utility.
|
||||
UTILITY = HAL_ROBOT_MODE_UTILITY
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -174,20 +174,20 @@ class ControlWord {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding test mode.
|
||||
* Check if the DS is commanding utility mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in test mode
|
||||
* @return True if the robot is being commanded to be in utility mode
|
||||
*/
|
||||
bool IsTest() const { return GetRobotMode() == RobotMode::TEST; }
|
||||
bool IsUtility() const { return GetRobotMode() == RobotMode::UTILITY; }
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding test mode and if it has enabled the robot.
|
||||
* Check if the DS is commanding utility mode and if it has enabled the robot.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in test mode and
|
||||
* @return True if the robot is being commanded to be in utility mode and
|
||||
* enabled.
|
||||
*/
|
||||
bool IsTestEnabled() const {
|
||||
return IsTest() && IsEnabled() && IsDSAttached();
|
||||
bool IsUtilityEnabled() const {
|
||||
return IsUtility() && IsEnabled() && IsDSAttached();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +217,7 @@ struct wpi::util::Struct<wpi::hal::ControlWord> {
|
||||
static constexpr size_t GetSize() { return 8; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
return "uint64 opModeHash:56;"
|
||||
"enum{unknown=0,autonomous=1,teleoperated=2,test=3}"
|
||||
"enum{unknown=0,autonomous=1,teleoperated=2,utility=3}"
|
||||
"uint64 robotMode:2;"
|
||||
"bool enabled:1;bool eStop:1;bool fmsAttached:1;bool dsAttached:1;";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user