It's fairly common to want to loop over some code when in a state and exit once exiting.
Say you are controlling a orbital launcher, for example. You'd want to loop over a set of instructions that measure position and acceleration and perform some actuation to control trajectory (state controlled_ascent). When your rocket fuel is empty you'd want to switch to a new piece of code that continuously reads sensor data and detects when below a certain altitude->deploy parachutes (state prepare_chute).
Given this problem, what would be an idiomatic way of implementing this state machine with stateless?
It's fairly common to want to loop over some code when in a state and exit once exiting.
Say you are controlling a orbital launcher, for example. You'd want to loop over a set of instructions that measure position and acceleration and perform some actuation to control trajectory (state
controlled_ascent
). When your rocket fuel is empty you'd want to switch to a new piece of code that continuously reads sensor data and detects when below a certain altitude->deploy parachutes (stateprepare_chute
).Given this problem, what would be an idiomatic way of implementing this state machine with
stateless
?