mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Remove LinearOpMode (#8638)
Linear OpModes have several major downsides with no obvious solutions: - Some things stop working automatically--e.g. in a linear opmode, simulation will not work out-of-the-box; the user must explicitly call sim themselves. there's a few other things we do periodically, but this is the big one (it also forces some decisions on other parts of the library—eg if we want Tunable to work in linear without the user manually calling refresh, we have to run it on a background thread, which means it must be thread safe throughout). We can help in some areas (e.g. have sleep functions call background things), but if the user is writing a loop that waits to drive a certain distance with no sleep, it's an easy footgun - Writing code with no sleeps is easy to do, and can hog an entire processing core easily--yes, there's more than one core, but it could still easily impact e.g. vision processing - Many people I've talked to want robot-level periodic and periodic sim functions. Given linear opmodes, we have two options, neither of which is great: (1) don't provide robot-level periodic functions, and the users who want those must set those up themselves and remember to call them explicitly from every periodic opmode, or (2) provide them, but only call them automatically from periodic opmodes, which could be confusing for linear opmode users (they'd have to call them manually if they wanted them). Currently we do (1) but someone in the community already opened a change to do (2). - Restarting the robot program fixes the "stuck in auto for the rest of the match" problem but still feels like an ugly hack because the startup time is not unlikely to make the robot not immediately ready for teleop Removing LinearOpMode resolves these issues by moving to a periodic-only structure. We can address the few notable use cases of LinearOpMode (e.g. very basic autonomous sequences) in other ways such as Blocks generated code, better state machine tutorials/documentation, etc.
This commit is contained in:
@@ -198,7 +198,6 @@ Encoder = "wpi/hardware/rotation/Encoder.hpp"
|
||||
DriverStationModeThread = "wpi/internal/DriverStationModeThread.hpp"
|
||||
|
||||
# wpi/opmode
|
||||
LinearOpMode = "wpi/opmode/LinearOpMode.hpp"
|
||||
OpMode = "wpi/opmode/OpMode.hpp"
|
||||
PeriodicOpMode = "wpi/opmode/PeriodicOpMode.hpp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user