Can not detect deck when using the step-by-step: motion commander guide
Posted: Fri Feb 12, 2021 2:11 pm
Hello,
I am currently trying to use the script provided in the Step-by-Step Guide. I copy-pasted the script and even if a deck is attached to the crazyflie, it still give back the "Deck is NOT attached" message. There is an existing topic about that issue, which suggested to change the int(value) but this did unfortunately not work for me.
Is there another solution?
Thanks in advance.
This is my current script:
import logging
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander
URI = 'radio://0/80/2M/E7E7E7E7E7'
is_deck_attached = False
logging.basicConfig(level=logging.ERROR)
def param_deck_flow(name, value_str):
value = int(value_str)
print(value)
global is_deck_attached
if value:
is_deck_attached = True
print('Deck is attached!')
else:
is_deck_attached = False
print('Deck is NOT attached!')
if __name__ == '__main__':
cflib.crtp.init_drivers(enable_debug_driver=False)
with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
scf.cf.param.add_update_callback(group="deck", name="bcFlow2",
cb=param_deck_flow)
time.sleep(1)
I am currently trying to use the script provided in the Step-by-Step Guide. I copy-pasted the script and even if a deck is attached to the crazyflie, it still give back the "Deck is NOT attached" message. There is an existing topic about that issue, which suggested to change the int(value) but this did unfortunately not work for me.
Is there another solution?
Thanks in advance.
This is my current script:
import logging
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander
URI = 'radio://0/80/2M/E7E7E7E7E7'
is_deck_attached = False
logging.basicConfig(level=logging.ERROR)
def param_deck_flow(name, value_str):
value = int(value_str)
print(value)
global is_deck_attached
if value:
is_deck_attached = True
print('Deck is attached!')
else:
is_deck_attached = False
print('Deck is NOT attached!')
if __name__ == '__main__':
cflib.crtp.init_drivers(enable_debug_driver=False)
with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
scf.cf.param.add_update_callback(group="deck", name="bcFlow2",
cb=param_deck_flow)
time.sleep(1)