Page 1 of 1

Measurements

Posted: Sun Jul 11, 2021 2:10 pm
by fede_tiberti
Hi, I'm working on a script which simulates a fall with the Mellinger controller.
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 use the positionHlCommander to takeoff because I don't have a positioning system but I have only the flow deck v2.
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?

Re: Measurements

Posted: Thu Jul 15, 2021 1:58 pm
by arnaud
Hi,

I would more think of a logging problem, it this was a real estimator output, you would likely have seen some drastic real-world effect.

How did you log the values? I cannot see any log-related code in your script.

Re: Measurements

Posted: Fri Jul 16, 2021 7:05 am
by fede_tiberti
Hi,
I don't think so, because with the PID controller the logging has no problem.

Sorry, I've forgot the logger script, I leave it in attachments now.

Re: Measurements

Posted: Wed Jul 21, 2021 12:42 pm
by kimberly
Hi!

So we haven't really been able to figure it out quite yet what is causing your problem...

Perhaps a hint could be that you are using different type of commanders so we don't know exactly how that will go well. What if you give the drone a stop signal with the high level commander instead perhaps?