Skip to content

Conversation

@ishrakj
Copy link

@ishrakj ishrakj commented Oct 20, 2025

This code was made in response to the FSM event handling issue. Essentially, if we want to change command flags in response to changes in the FSM, we have to put all the command flag changes in the tick_FSM() function, which creates problems for code readability and extending infrastructure.

This implementation addresses the issue by abstracting the changing of command flags behind a new struct titled MIDAS_Events. MIDAS_Events contains multiple functions, each corresponding to a state change (for instance, safe_to_pyroTest() corresponds to when the FSM is transitioning from the SAFE state to the PYRO_TEST state). In the fsm.cpp file, when there's a state transition, the corresponding MIDAS_Events function is called and takes in as a parameter the CommandFlags object passed to the tick_fsm() function. The command flags are then changed accordingly in the MIDAS_Events function defined in the MIDAS_Events.cpp file. The MIDAS_Events header and cpp files are both located in the finite-state-machines folder under src.

@mpkarpov-ui
Copy link
Contributor

I took a look at this PR yesterday with @SuragNuthulapaty and after some brief discussion we came to the conclusion that this is a good implementation but needs some improvements (primarily, the RocketData pointer struct should always be present in an event callback).

Since we're likely not going to be able to extensively test this and integrate it before all hands, let's come back to this after the LUNA launch.

…erence command_flags, updated tick_fsm to take in rocket_data instead of commandflags
Copy link
Author

@ishrakj ishrakj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated MIDAS_Events functions to take in a RocketData pointer

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

Successfully merging this pull request may close these issues.

3 participants