SM manages the drone at the highest level. It acts as the “brains” of the drone and decides the mode of operation based on the inputs from Telemetry Manager, RC, SF, and CV messages.
SM decodes RC messages, converts them into waypoint targets and passes them with a “TELEOP” waypoint type to PM which just passes them to AM. These waypoints are a higher priority
SM decodes CV waypoints and passes waypoint and with a respective waypoint_type to PM so it can plan the path and send the waypoints (one at a time) to AM.
SM also passes SF data through PM which sends it to AM.
SM takes any returned data from AM (from previous operation cycles) and passes it to Telemetry to be sent to the ground station.
Outside of flight SM shuts down threads and sets motors to 0. It also shuts down everything and sets motors to 0 if it goes into fatal failure mode.
Why are we sending RC messages through PM to get to AM?
This decision was made at least for the Nov 27th test to keep all messages going to AM during flight from the same source (PM) and of the same format (waypoints).
This is a temporary solution until a better one can be prioritized. This “queue” should only have maximum one message at a time so that a replacement (that is not a queue) can just be dropped in.