Measurements

Discussions about quadcopters/multi-rotors
Post Reply
fede_tiberti
Beginner
Posts: 13
Joined: Tue Apr 13, 2021 9:09 am

Measurements

Post 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?
Attachments
mell1_a-eps-converted-to.pdf
(84.33 KiB) Downloaded 318 times
mell1_h-eps-converted-to.pdf
(26.26 KiB) Downloaded 311 times
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Measurements

Post 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.
fede_tiberti
Beginner
Posts: 13
Joined: Tue Apr 13, 2021 9:09 am

Re: Measurements

Post 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.
Attachments
logData.py
(15.06 KiB) Downloaded 320 times
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Measurements

Post 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?
Post Reply