Skip to content

Commit d03c5ff

Browse files
committed
Updated the supervisor examples
1 parent d5b0062 commit d03c5ff

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

examples/supervisor/flying_with_supervisor.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import cflib.crtp
3434
from cflib.crazyflie import Crazyflie
35-
from cflib.crazyflie.supervisor import SupervisorState
3635
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
3736
from cflib.utils import uri_helper
3837

@@ -41,7 +40,7 @@
4140
uri = uri_helper.uri_from_env(default='radio://0/80/2M/E7E7E7E7E7')
4241

4342

44-
def safety_check(sup: SupervisorState):
43+
def safety_check(sup):
4544
if sup.is_crashed:
4645
raise Exception('Crazyflie crashed!')
4746
if sup.is_locked:
@@ -50,15 +49,15 @@ def safety_check(sup: SupervisorState):
5049
raise Exception('Crazyflie tumbled!')
5150

5251

53-
def run_sequence(scf: SyncCrazyflie, sup: SupervisorState):
52+
def run_sequence(scf: SyncCrazyflie, sup):
5453
commander = scf.cf.high_level_commander
5554

5655
try:
5756
safety_check(sup)
5857
if sup.can_be_armed:
5958
print('The Crazyflie can be armed...arming!')
6059
safety_check(sup)
61-
scf.cf.platform.send_arming_request(True)
60+
sup.send_arming_request(True)
6261
time.sleep(1)
6362

6463
safety_check(sup)
@@ -84,6 +83,6 @@ def run_sequence(scf: SyncCrazyflie, sup: SupervisorState):
8483

8584
with SyncCrazyflie(uri, cf=Crazyflie(rw_cache='./cache')) as scf:
8685
time.sleep(1)
87-
supervisor = SupervisorState(scf)
86+
supervisor = scf.cf.supervisor
8887
time.sleep(1)
8988
run_sequence(scf, supervisor)

examples/supervisor/reading_supervisor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import cflib.crtp
3434
from cflib.crazyflie import Crazyflie
35-
from cflib.crazyflie.supervisor import SupervisorState
3635
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
3736
from cflib.utils import uri_helper
3837

@@ -47,7 +46,7 @@
4746

4847
with SyncCrazyflie(uri, cf=Crazyflie(rw_cache='./cache')) as scf:
4948
time.sleep(1)
50-
supervisor = SupervisorState(scf)
49+
supervisor = scf.cf.supervisor
5150
time.sleep(1)
5251
try:
5352
while True:

0 commit comments

Comments
 (0)