Is altimeter (LidarLite) compensating the roll/pitch?

Here is an interesting question that I would like to share:

Is the estimation of the terrain altitude considering the attitude of the UAV?
Any pointer to the code?
What happens if I put the altimeter on a stabilized gimbal such that it always point downward?

and here is also the answer:

Yes, the estimation of the terrain altitude takes into account the altitude of the UAV and can be found here.

When changing the altimeter on a stabilized gimbal, you will need to change the code to not account for the tilt angle.

Thanks for your findings. This info is very helpful. :wink:

Thanks, @Kyuhyong_You!

Thanks for moving my answer here ;).

Hi, interesting function, could you tell me where to implement this code in the PX4?

Thanks

Tim

@Zouritte If you have a stabilized range finder, you would have to remove the projection to the vertical axis : https://github.com/PX4/ecl/blob/master/EKF/terrain_estimator.cpp#L122 and maybe increase range_cos_max_tilt depending of how much your gimbal can move.
If you want to implement it properly and push it back to PX4, you should also consider having a parameter to choose whether the sensor is stabilized of fixed to the drone.

Good luck!