Hi all, I have enabled optical flow and range finder (downward facing distance sensor) on my drone and disabled the GNSS (EKF2_GPS_CTRL = 0), but I get a strange behavior and the drone seems to be “swinging”. I am attaching a log and a video showing this, do you have any takes on why that is?
I guess that the altitude instability can be fixed with some PID tuning, but I am not sure about the horizontal instability - any ideas on that?
Thanks,
~ Nick
Hi Nick
I haven’t looked at your log but some starting points for you.
- Have you correctly set the relative position of the optical flow sensor (EKF2_OF_POS_X/Y/Z)? If not set correctly, the angular-velocity correction will be faulty which will degrade the OF quality and degrade overall performance.
- Have you done some investigation if the delay is set correctly? You can start logging in a bench-setup and move the system abruptly, then compare the OF and IMU data.
- 1./2. often improve the oscillations massively. Further you can increaese EKF2_OF_N_MIN to trust the sensor a bit less and decrease MPC_XY_P to make the controller slightly less aggressive.
Hope this helps, Marco
Thanks for the tip. Will try it out and let you know
~ Nick
Hi @haumarco, I did this bench test (quite short as you see) and tried turning the drone along the z axis abruptly. This is the result I get and I interpret it like there is no delay between OF and IMU - does it make sense?
~ Nick
yes, possible. you can check sensor_combined, which is the imu topic but at a much higher rate. you can also compare the timestamps with a python script or similar. also make sure to do the other steps i mentioned