I want to control crazyflie's thrust using crazyflie-lib-python and the bluetooth dongle. I am using this minimal example from the user guide:
Code: Select all
import cflib.crtp
from cflib.crazyflie import Crazyflie
import os
import time
import logging
## Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)
if __name__ == '__main__':
cflib.crtp.init_drivers(enable_debug_driver=False)
cf = Crazyflie(rw_cache=os.path.expanduser("~") + "/.cache")
cf.open_link('radio://0/13/2M/E7E7E7E7E7')
time.sleep(3) # give some time to establish connection; 3 sec seems to work
# Send thrust of 30000 for 3 seconds
for i in range(300):
cf.commander.send_setpoint(0.0, 0.0, 0, 30000)
time.sleep(0.01) # send the setpoint once every 10 ms as per the user guide
cf.commander.send_stop_setpoint()
cf.close_link()
Thanks!