Problem with althold with range sensor

Hi, we are trying to do a basic altitude hold using the leddar one lidar. We have the sensor enabled and EKF2 range aid enabled and the height mode set to use the range finder. However it seems like it bounces up and down quite a bit. Attached is he flight log. Any help would be greatly helpful!

Estimation seems to know that the altitude is constantly chaning

I would first try to tune the z-axis velocity controller that means increasing MPC_Z_VEL_P and MPC_Z_VEL_I one after the other carefully testing with each small increment if it gets better or worse. In case these gains are too high the drone will oscillate up and down but much quicker than in your log.

One additional thing to note for your further testing is when flying with the range sensor there’s a threshold for the maximal velocity the measurements are still considered EKF2_RNG_A_VMAX. The conservative default is 1m/s. Same goes for maximum range sensor altitude EKF2_RNG_A_HMAX with default 5m.

And before I forget there’s also a minimum range EKF2_MIN_RNG which came to my mind because you were neither flying fast nor high but rather close to the ground. Make sure the range finder you use can actually measure the minimum distance you set here it’s better to not use wrong data.

Hi @Shobhit_Mehrotra, looking at your flight log, I think you have a vibration problem that could cause what you are seeing as well as some of the rate controller overshoot that visible in your log. As a first step, I’d suggest balancing your propellers and doing what you can to vibration isolate your IMU/autopilot, then revisit all of your rate controller gains, particularly yaw. When those details are attended to the system will have more actuator margin to deal with altitude fluctuations.

Thanks so much mcsauder and matetugr! The issue was related to PID tuning and vibrations. We mounted our Pixhawk 4 on vibrations dampers. We adjusted pids and reduced the imu gyro cutoff to 20hz. Also one thing to note is that on v1.9…2 to use the lidar we had to adjust to terrain following