Skip to content

Commit fe74cab

Browse files
committed
Slightly reshaped supervisor files
1 parent a358ddb commit fe74cab

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

cflib/utils/supervisor_state.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
77
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
88
#
9-
# Copyright (C) 2020 Bitcraze AB
9+
# Copyright (C) 2025 Bitcraze AB
1010
#
1111
# This program is free software: you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,11 @@
1919
#
2020
# You should have received a copy of the GNU General Public License
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
"""
23+
This class is used to easily get the state of your Crazyflie by through
24+
the supervisor. Check the `reading_supervisor.py` example in
25+
examples/supervisor/ to better understand how it works.
26+
"""
2227
import threading
2328

2429
from cflib.crazyflie.log import LogConfig
@@ -29,7 +34,7 @@ class SupervisorState:
2934
STATES = [
3035
'Can be armed',
3136
'Is armed',
32-
'Auto armed',
37+
'Is auto armed',
3338
'Can fly',
3439
'Is flying',
3540
'Is tumbled',
@@ -100,17 +105,17 @@ def decode_bitfield(self, value):
100105
returns the names of all states whose bits are set.
101106
Bit 0 corresponds to states[0], Bit 1 to states[1], etc.
102107
103-
* Bit 0 = Can be armed - the system can be armed and will accept an arming command
104-
* Bit 1 = is armed - the system is armed
105-
* Bit 2 = auto arm - the system is configured to automatically arm
106-
* Bit 3 = can fly - the Crazyflie is ready to fly
107-
* Bit 4 = is flying - the Crazyflie is flying.
108-
* Bit 5 = is tumbled - the Crazyflie is up side down.
109-
* Bit 6 = is locked - the Crazyflie is in the locked state and must be restarted.
110-
* Bit 7 = is crashed - the Crazyflie has crashed.
111-
* Bit 8 = high level control is actively flying the drone
112-
* Bit 9 = high level trajectory has finished
113-
* Bit 10 = high level control is disabled and not producing setpoints
108+
* Bit 0 = Can be armed - the system can be armed and will accept an arming command.
109+
* Bit 1 = Is armed - the system is armed.
110+
* Bit 2 = Is auto armed - the system is configured to automatically arm.
111+
* Bit 3 = Can fly - the Crazyflie is ready to fly.
112+
* Bit 4 = Is flying - the Crazyflie is flying.
113+
* Bit 5 = Is tumbled - the Crazyflie is up side down.
114+
* Bit 6 = Is locked - the Crazyflie is in the locked state and must be restarted.
115+
* Bit 7 = Is crashed - the Crazyflie has crashed.
116+
* Bit 8 = High level control is actively flying the drone.
117+
* Bit 9 = High level trajectory has finished.
118+
* Bit 10 = High level control is disabled and not producing setpoints.
114119
"""
115120
if value < 0:
116121
raise ValueError('value must be >= 0')

examples/supervisor/reading_supervisor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def run_sequence(scf: SyncCrazyflie, sup: SupervisorState):
5656

5757
try:
5858
if sup.can_be_armed():
59+
print('The Crazyflie can be armed...arming!')
5960
safety_check(sup)
6061
scf.cf.platform.send_arming_request(True)
6162
time.sleep(1)

0 commit comments

Comments
 (0)