[wpilib] Rename TimedRobot constants to all caps

This commit is contained in:
Peter Johnson
2026-03-17 16:42:32 -07:00
parent 48868020a9
commit 09be21c319
7 changed files with 11 additions and 11 deletions

View File

@@ -93,7 +93,7 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
private final List<Optional<Command>> m_toCancelInterruptors = new ArrayList<>(); private final List<Optional<Command>> m_toCancelInterruptors = new ArrayList<>();
private final Set<Command> m_endingCommands = new LinkedHashSet<>(); private final Set<Command> m_endingCommands = new LinkedHashSet<>();
private final Watchdog m_watchdog = new Watchdog(TimedRobot.kDefaultPeriod, () -> {}); private final Watchdog m_watchdog = new Watchdog(TimedRobot.DEFAULT_PERIOD, () -> {});
CommandScheduler() { CommandScheduler() {
HAL.reportUsage("CommandScheduler", ""); HAL.reportUsage("CommandScheduler", "");

View File

@@ -62,7 +62,7 @@ static bool ContainsKey(const TMap& map, TKey keyToCheck) {
} }
CommandScheduler::CommandScheduler() CommandScheduler::CommandScheduler()
: m_impl(new Impl), m_watchdog(wpi::TimedRobot::kDefaultPeriod, [] { : m_impl(new Impl), m_watchdog(wpi::TimedRobot::DEFAULT_PERIOD, [] {
std::puts("CommandScheduler loop time overrun."); std::puts("CommandScheduler loop time overrun.");
}) { }) {
HAL_ReportUsage("CommandScheduler", ""); HAL_ReportUsage("CommandScheduler", "");

View File

@@ -105,7 +105,7 @@ class CommandScheduler(Sendable):
# self._toCancelInterruptors: List[Optional[Command]] = [] # self._toCancelInterruptors: List[Optional[Command]] = []
self._endingCommands: Set[Command] = set() self._endingCommands: Set[Command] = set()
self._watchdog = Watchdog(TimedRobot.kDefaultPeriod, lambda: None) self._watchdog = Watchdog(TimedRobot.DEFAULT_PERIOD, lambda: None)
hal.reportUsage("CommandScheduler", "") hal.reportUsage("CommandScheduler", "")

View File

@@ -7,10 +7,10 @@ seconds = float
class TimedCommandRobot(TimedRobot): class TimedCommandRobot(TimedRobot):
kSchedulerOffset = 0.005 SCHEDULER_OFFSET = 0.005
def __init__(self, period: seconds = TimedRobot.kDefaultPeriod / 1000) -> None: def __init__(self, period: seconds = TimedRobot.DEFAULT_PERIOD / 1000) -> None:
super().__init__(period) super().__init__(period)
self.addPeriodic( self.addPeriodic(
CommandScheduler.getInstance().run, period, self.kSchedulerOffset CommandScheduler.getInstance().run, period, self.SCHEDULER_OFFSET
) )

View File

@@ -31,7 +31,7 @@ namespace wpi {
class TimedRobot : public IterativeRobotBase { class TimedRobot : public IterativeRobotBase {
public: public:
/// Default loop period. /// Default loop period.
static constexpr auto kDefaultPeriod = 20_ms; static constexpr auto DEFAULT_PERIOD = 20_ms;
/** /**
* Provide an alternate "main loop" via StartCompetition(). * Provide an alternate "main loop" via StartCompetition().
@@ -48,7 +48,7 @@ class TimedRobot : public IterativeRobotBase {
* *
* @param period The period of the robot loop function. * @param period The period of the robot loop function.
*/ */
explicit TimedRobot(wpi::units::second_t period = kDefaultPeriod); explicit TimedRobot(wpi::units::second_t period = DEFAULT_PERIOD);
/** /**
* Constructor for TimedRobot. * Constructor for TimedRobot.

View File

@@ -1,7 +1,7 @@
classes: classes:
wpi::TimedRobot: wpi::TimedRobot:
attributes: attributes:
kDefaultPeriod: DEFAULT_PERIOD:
methods: methods:
StartCompetition: StartCompetition:
EndCompetition: EndCompetition:

View File

@@ -66,7 +66,7 @@ public class TimedRobot extends IterativeRobotBase {
} }
/** Default loop period. */ /** Default loop period. */
public static final double kDefaultPeriod = 0.02; public static final double DEFAULT_PERIOD = 0.02;
// The C pointer to the notifier object. We don't use it directly, it is // The C pointer to the notifier object. We don't use it directly, it is
// just passed to the JNI bindings. // just passed to the JNI bindings.
@@ -79,7 +79,7 @@ public class TimedRobot extends IterativeRobotBase {
/** Constructor for TimedRobot. */ /** Constructor for TimedRobot. */
protected TimedRobot() { protected TimedRobot() {
this(kDefaultPeriod); this(DEFAULT_PERIOD);
} }
/** /**