Here the code:
Code: Select all
if __name__ == '__main__':
cflib.crtp.init_drivers(enable_debug_driver=False)
crazyf = Crazyflie(rw_cache='./cache')
crazyf.param.set_value('kalman.resetEstimation', '1')
time.sleep(0.5)
crazyf.param.set_value('kalman.resetEstimation', '0')
time.sleep(0.5)
h_in = 1.3
h_fin = 1
crazyf.param.set_value('stabilizer.controller', '2')
cf_M = position_hl_commander.PositionHlCommander(crazyf, controller=2)
time.sleep(1)
cf_M.take_off(h_in)
for i in range(15):
crazyf.commander.send_hover_setpoint(0, 0, 0, h_in) #hover
time.sleep(0.1)
for i in range(3):
crazyf.commander.send_zdistance_setpoint(2, 0, 0, h_in-0.1)
time.sleep(0.1)
crazyf.commander.send_stop_setpoint()
time.sleep(0.10)
for i in range(15):
crazyf.commander.send_zdistance_setpoint(0, 0, 0, h_fin)
time.sleep(0.1)
for i in range(10):
crazyf.commander.send_hover_setpoint(0, 0, 0, ((10 - i-2) / 10) * h_fin) #landing
time.sleep(0.1)
I tested this code 20 times and then I obtained the graphs that I left in the attachments, in which there are 20 light blue lines that represent the 20 test and there is a red thicker line that is the arithmetic average of the 20 attemps.
The question is: Why do the height and the yaw drop instantaneously to zero sometimes? In the reality this behaviour does not happen.
I tought that it could be a not reliability estimation from the Kalman filter, what do you think?