Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detail to The Scheduler Run Sequence #2297

Open
tom131313 opened this issue Jul 19, 2023 · 2 comments
Open

Add detail to The Scheduler Run Sequence #2297

tom131313 opened this issue Jul 19, 2023 · 2 comments

Comments

@tom131313
Copy link

Regarding Document

An important use, of a subsystem as a Finite State Machine and its dependent commands as States of that FSM upon a trigger/button event to initiate a transition from one state to another, depends on the following sequence:

the end method of the current (interrupted) command (state) is run before the initialize method of the new (interrupting) command (state).

Using state exit and enter like this somewhat special case depends on the user correctly specifying a FSM as a subsystem and that subsystem being a requirement of all the commands that reflect states of that FSM and the commands can be interrupted by subsequent commands.

WPILib supports that sequence and adding detail to the documentation to describe that case works would help users.

ChiefDelphi reference

@Starlight220
Copy link
Member

Just to make sure I understand, the request here is to clarify that interrupted command end is called before interrupting command init?
Anything more than that?

@tom131313
Copy link
Author

Yes and all this happens in the same timestep to provide a bump-less transition to a new state:

  1. event triggers new command with dependency on a subsystem
  2. end() the running command for that subsystem
  3. initialize() new command for that subsystem

In ChiefDelphi I made this comment about an example application of this feature is to make a smooth, safe motor speed transition (assuming the motor set() speed is also properly handled and that might not be obvious coding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants