I’d like the rotation to stop when the mode is exited. What’s the best way to do it ? I’ve tried to use the exit() function Guidance API - 7.7 but it does not work.
The way to do it is to add a transition in the mission transition table to switch flight supervisor state (i.e switch from the state making the drone rotate to a state making making the drone hovering).
This transition should be based either:
On a message (event) sent by your guidance mode or by an internal message of the flight supervisor.
To declare a message in a guidance mode you need to add it to the protobuf associated to the guidance mode and create an event sender in the guidance mode.
On an internal message (event) of the flight supervisor state machine
To declare an internal message endpoint (aka service) in the flight supervisor state machine:
the protobuf file mymission_fsup_msgs can be created in the fsup directoy under fsup/protobuf/mymission/fsup/messages.proto with the Command/Event msghub structure and rules to build it added in the main fsup ‘atom.mk’ by adding the following code: