Provides access to the supervisor module of the Crazyflie platform.
Classes
Supervisor
Supervisor(crazyflie)
This class provides two main functionalities:
-
Reading the system state Accesses the Crazyflie’s supervisor bitfield to determine the current state, such as whether it can be armed, is flying or crashed.
-
Sending system commands Sends arming/disarming requests and crash recovery commands to the Crazyflie.
Class variables
STATES
Instance variables
can_be_armed
can_fly
hl_control_active
hl_control_disabled
hl_traj_finished
is_armed
is_auto_armed
is_crashed
is_flying
is_locked
is_tumbled
Methods
def decode_bitfield(self, value)
Given a bitfield integer value and a list of self.STATES,
returns the names of all states whose bits are set.
Bit 0 corresponds to states[0], Bit 1 to states[1], etc.
- Bit 0 = Can be armed - the system can be armed and will accept an arming command.
- Bit 1 = Is armed - the system is armed.
- Bit 2 = Is auto armed - the system is configured to automatically arm.
- Bit 3 = Can fly - the Crazyflie is ready to fly.
- Bit 4 = Is flying - the Crazyflie is flying.
- Bit 5 = Is tumbled - the Crazyflie is up side down.
- Bit 6 = Is locked - the Crazyflie is in the locked state and must be restarted.
- Bit 7 = Is crashed - the Crazyflie has crashed.
- Bit 8 = High level control is actively flying the drone.
- Bit 9 = High level trajectory has finished.
- Bit 10 = High level control is disabled and not producing setpoints.
def read_bitfield(self)
Directly get the full bitfield value.
def read_state_list(self)
Reads the bitfield and returns the list of all active states.
def send_arming_request(self, do_arm: bool)
Send system arm/disarm request.
If the connected Crazyflie does not support CRTP protocol version 12 or later, the legacy platform channel is used as a fallback.
Args: do_arm (bool): True = arm the system, False = disarm the system
def send_crash_recovery_request(self)
Send crash recovery request.
If the connected Crazyflie does not support CRTP protocol version 12 or later, the legacy platform channel is used as a fallback.
def send_emergency_stop(self)
Send emergency stop. The Crazyflie will immediately stop all motors.
If the connected Crazyflie does not support CRTP protocol version 12 or later, the legacy localization channel is used as a fallback.
def send_emergency_stop_watchdog(self)
Send emergency stop watchdog. The Crazyflie will stop all motors unless this command is repeated at regular intervals.
If the connected Crazyflie does not support CRTP protocol version 12 or later, the legacy localization channel is used as a fallback.