robotpy / robotpy-wpilib-utilities

Useful utility functions/objects for RobotPy
BSD 3-Clause "New" or "Revised" License
11 stars 19 forks source link

magicbot mode exit methods #205

Open auscompgeek opened 1 year ago

auscompgeek commented 1 year ago

For the 2022 season methods were added to TimedRobot to run code on mode exit, i.e. disabledExit, autonomousExit, teleopExit, and testExit. magicbot should have the same, although we should make sure the ordering makes sense with all the interactions with components.

I suspect we want the following, with the philosophy that more specific methods are called later:

Obviously disabledExit and testExit would be called at the very end of disabled and test modes, and there's no ordering concerns as no other code really runs in those modes.

robotPeriodic will continue to run after all other periodic code as its intent is for user telemetry code.

auscompgeek commented 1 year ago

@virtuald do you agree with the ordering for auto here? I think we currently call the auto routine's on_disable before component on_disable, so this'd be a breaking change.