mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Rename TimedRobot constants to all caps
This commit is contained in:
@@ -93,7 +93,7 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
|
||||
private final List<Optional<Command>> m_toCancelInterruptors = new ArrayList<>();
|
||||
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() {
|
||||
HAL.reportUsage("CommandScheduler", "");
|
||||
|
||||
@@ -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", "");
|
||||
|
||||
@@ -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", "")
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
classes:
|
||||
wpi::TimedRobot:
|
||||
attributes:
|
||||
kDefaultPeriod:
|
||||
DEFAULT_PERIOD:
|
||||
methods:
|
||||
StartCompetition:
|
||||
EndCompetition:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user