Hello Drone mission¶
The Hello Drone mission is a comprehensive Air SDK mission demonstrating how to:
Use flight supervisor default state machine and import its structure as is
Override some of the default states, in order to insert custom transitions or guidance modes and execute the hello movement into the state machine
Write a guidance mode with a trajectory generation for cameras
Create a native service to access the video (stereo cams) and telemetry APIs, as well as depth calculation to evaluate distance to obstacle
Handle the service process thanks to threads and mutex
Exchange data between the three entities, thanks to the msghub environment
Send commands and receive events thanks to msghub and the protobuf protocole
When the Hello Drone mission is activated, the drone tilts its head.
The source code is available here.
Hello flight supervisor state machine¶
This code defines the states and transitions of the hello mission in Python.
It uses default mission takeoff, hovering, landing and critical stages and creates specific ground
and flying stages.
Two transitions are defined to switch between
idle and say states of ground stage. The drone behaviors while in those states are defined
along with the appropriate guidance modes. Its flying stage only keeps the manual state : the drone
can be manually flown, but can’t follow a flightplan.
It also sets up the whole messages exchange handler, whether they are commands or events. It is also explained how to deal with observers, which react to commands and events. Flight supervisor is a transparent proxy between Remote UI, the service, and the guidance modes. If the messages exchange concept remains fuzzy, do have a check at the messages section, which explains how to implement it.
To get help on how to customize the flight supervisor state machine, see how to modify the state machine.
Hello guidance mode¶
This code defines the guidance specific HelloGroundMode in Python.
In this mode, the orientation of the front camera performs the hello
animation, thanks to a predefined trajectory. The mode is also responsible for configuring the cameras
(front and stereo). A message count is sent to flight supervisor,
counting the number of times the front camera has performed the hello animation.
The guidance modes are activated from flight supervisor.
To get help on how to customize a guidance mode, see how to write a guidance mode.
Hello service¶
The service computes the mean depth from the depth map video feed of the stereo camera. It demonstrates how to define a telemetry consumer and producer, and how to instantiate a client video feed.