From 09be21c319744383942edf7ce05ab9bca1bcf805 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 17 Mar 2026 16:42:32 -0700 Subject: [PATCH] [wpilib] Rename TimedRobot constants to all caps --- .../src/main/java/org/wpilib/command2/CommandScheduler.java | 2 +- .../src/main/native/cpp/frc2/command/CommandScheduler.cpp | 2 +- commandsv2/src/main/python/commands2/commandscheduler.py | 2 +- commandsv2/src/main/python/commands2/timedcommandrobot.py | 6 +++--- .../src/main/native/include/wpi/framework/TimedRobot.hpp | 4 ++-- wpilibc/src/main/python/semiwrap/TimedRobot.yml | 2 +- wpilibj/src/main/java/org/wpilib/framework/TimedRobot.java | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/commandsv2/src/main/java/org/wpilib/command2/CommandScheduler.java b/commandsv2/src/main/java/org/wpilib/command2/CommandScheduler.java index 699811a2d6..a9cf2c8aba 100644 --- a/commandsv2/src/main/java/org/wpilib/command2/CommandScheduler.java +++ b/commandsv2/src/main/java/org/wpilib/command2/CommandScheduler.java @@ -93,7 +93,7 @@ public final class CommandScheduler implements Sendable, AutoCloseable { private final List> m_toCancelInterruptors = new ArrayList<>(); private final Set m_endingCommands = new LinkedHashSet<>(); - private final Watchdog m_watchdog = new Watchdog(TimedRobot.kDefaultPeriod, () -> {}); + private final Watchdog m_watchdog = new Watchdog(TimedRobot.DEFAULT_PERIOD, () -> {}); CommandScheduler() { HAL.reportUsage("CommandScheduler", ""); diff --git a/commandsv2/src/main/native/cpp/frc2/command/CommandScheduler.cpp b/commandsv2/src/main/native/cpp/frc2/command/CommandScheduler.cpp index 41c8a1798f..1685d62a2a 100644 --- a/commandsv2/src/main/native/cpp/frc2/command/CommandScheduler.cpp +++ b/commandsv2/src/main/native/cpp/frc2/command/CommandScheduler.cpp @@ -62,7 +62,7 @@ static bool ContainsKey(const TMap& map, TKey keyToCheck) { } 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."); }) { HAL_ReportUsage("CommandScheduler", ""); diff --git a/commandsv2/src/main/python/commands2/commandscheduler.py b/commandsv2/src/main/python/commands2/commandscheduler.py index 45d6985a4c..b99eebbdbe 100644 --- a/commandsv2/src/main/python/commands2/commandscheduler.py +++ b/commandsv2/src/main/python/commands2/commandscheduler.py @@ -105,7 +105,7 @@ class CommandScheduler(Sendable): # self._toCancelInterruptors: List[Optional[Command]] = [] self._endingCommands: Set[Command] = set() - self._watchdog = Watchdog(TimedRobot.kDefaultPeriod, lambda: None) + self._watchdog = Watchdog(TimedRobot.DEFAULT_PERIOD, lambda: None) hal.reportUsage("CommandScheduler", "") diff --git a/commandsv2/src/main/python/commands2/timedcommandrobot.py b/commandsv2/src/main/python/commands2/timedcommandrobot.py index a012e4f842..5963a512d8 100644 --- a/commandsv2/src/main/python/commands2/timedcommandrobot.py +++ b/commandsv2/src/main/python/commands2/timedcommandrobot.py @@ -7,10 +7,10 @@ seconds = float 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) self.addPeriodic( - CommandScheduler.getInstance().run, period, self.kSchedulerOffset + CommandScheduler.getInstance().run, period, self.SCHEDULER_OFFSET ) diff --git a/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp b/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp index b05eb823bc..bba8f07a98 100644 --- a/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp +++ b/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp @@ -31,7 +31,7 @@ namespace wpi { class TimedRobot : public IterativeRobotBase { public: /// Default loop period. - static constexpr auto kDefaultPeriod = 20_ms; + static constexpr auto DEFAULT_PERIOD = 20_ms; /** * Provide an alternate "main loop" via StartCompetition(). @@ -48,7 +48,7 @@ class TimedRobot : public IterativeRobotBase { * * @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. diff --git a/wpilibc/src/main/python/semiwrap/TimedRobot.yml b/wpilibc/src/main/python/semiwrap/TimedRobot.yml index 0f57397833..469f818d24 100644 --- a/wpilibc/src/main/python/semiwrap/TimedRobot.yml +++ b/wpilibc/src/main/python/semiwrap/TimedRobot.yml @@ -1,7 +1,7 @@ classes: wpi::TimedRobot: attributes: - kDefaultPeriod: + DEFAULT_PERIOD: methods: StartCompetition: EndCompetition: diff --git a/wpilibj/src/main/java/org/wpilib/framework/TimedRobot.java b/wpilibj/src/main/java/org/wpilib/framework/TimedRobot.java index 36cc513228..f2565b0632 100644 --- a/wpilibj/src/main/java/org/wpilib/framework/TimedRobot.java +++ b/wpilibj/src/main/java/org/wpilib/framework/TimedRobot.java @@ -66,7 +66,7 @@ public class TimedRobot extends IterativeRobotBase { } /** 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 // just passed to the JNI bindings. @@ -79,7 +79,7 @@ public class TimedRobot extends IterativeRobotBase { /** Constructor for TimedRobot. */ protected TimedRobot() { - this(kDefaultPeriod); + this(DEFAULT_PERIOD); } /**