Skip to content

Comments

Supervisor subsystem#581

Open
ArisMorgens wants to merge 11 commits intomasterfrom
Aris/crtp_supervisor_lib
Open

Supervisor subsystem#581
ArisMorgens wants to merge 11 commits intomasterfrom
Aris/crtp_supervisor_lib

Conversation

@ArisMorgens
Copy link
Member

@ArisMorgens ArisMorgens commented Nov 19, 2025

This PR fixes #530 and should be merged after the firmware PR #1560 is merged. It adds a supervisor subsystem for reading the supervisor states.

Specifically:

  • read_bitfield() returns the full bitfield value.
  • read_state_list() returns a list of all active states.
  • All the individual state checks return True if they're active and False if they're not. can_be_armed, is_armed, is_auto_armed, can_fly, is_flying, is_tumbled, is_locked, is_crashed, active_hl_control, finished_hl_traj, disabled_hl_control

Every time we want to read a state, the entire bitfield is fetched. To avoid sending CRTP packets too frequently, the bitfield is cached for 0.1 seconds.

Also, 2 simple examples are added; 1 for reading the supervisor states and 1 for flying using the state information.

Update:
The supervisor commands (send_arming_request and send_recovery_request) are also moved from platformservice.py to supervisor.py. The user can still use the old commands (e.g. scf.cf.platform.send_arming_request(True)) but they'll get a deprecation warning.

…equivalents

Move send_emergency_stop() and send_emergency_stop_watchdog() to the Supervisor class using the CRTP supervisor channel. Deprecate the Localization versions with a backwards-compatible fallback to the old localization channel for firmware below protocol version 12.
All public methods now warn and bail early if the connected
Crazyflie reports a protocol version < 12, which is required
for the supervisor port.
@gemenerik
Copy link
Member

Added CRTP protocol version guards to the supervisor subsystem. All public methods now warn and bail early if the connected firmware doesn't report protocol version ≥ 12.

Honestly the versioning story in this Python lib has been a bit of a mess (most subsystems have no guards at all). The Rust rewrite will have a much stricter versioning contract so this kind of ambiguity won't carry over.

@gemenerik gemenerik requested a review from evoggy February 24, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add supervisor state reading interface

2 participants