Controlling thrust using crazyflie-lib-python
Posted: Tue Dec 08, 2020 3:05 am
Hi,
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:
I can connect to the crazyflie (cf.is_connected() returns True) and I can also see the green/red (Tx/Rx) LED on the crazyflie go on as expected, but the propellers do not spin, no matter what thrust value I send for whatever amount of time. I did get the high level MotionCommander working (with syncCrazyflie) as expected but cannot get the thrust control (from Commander) to work. Please let me know if I am doing something wrong.
Thanks!
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!