How does the firmware handle faulty lidar measurements?

Hey,
I fly with LidarLite V3 (ll40ls) and ekf2. HGT estimation is set to lidar. I figured out, that i have got some faulty measurements where local position gives me 10m as altitude but the quads height was 20m. in same flight session one time the altitude was suddenly negative.

my question. is the baro a fallback system if lidar measurement is detected as useless?

@TobiasM The ekf will reject range measurements as soon as they fail innovation consistency checks. If they keep being rejected then the height covariance will grow and eventually a height reset will take place. The ekf will check if fresh range data is available for a reset. If yes, it will reset the height based on the range data, otherwise it will declare the range sensor faulty and switch the primary height source to baro.

Here are some relevant links:

  1. Innovation consistency checks
    https://github.com/PX4/ecl/blob/master/EKF/vel_pos_fusion.cpp#L180

  2. Trigger height reset if covariance is large
    https://github.com/PX4/ecl/blob/master/EKF/control.cpp#L468

  3. Location where actual reset takes place and availability of data is checked
    https://github.com/PX4/ecl/blob/master/EKF/ekf_helper.cpp#L145

If you need further help then please share a log and ping me here on this issue.
FYI, I’m working on some stuff which you might be interested in, see

Thx for your explanation. This explains my copters behaviour. i flew in offboard mode with z-setpoint at 10 meters. at one point it increased its altitude drastically. my rosbag file shows me that at this timestamp the local_position.z was suddenly <0 meters.

will have a look on this behavior next flights

@TobiasM In case of a state reset the ekf publishes state delta values so that the controllers can shift their setpoints.
The mc position controller also takes these delta values into account, maybe you should check if there is something mission for offboard control.

i will post some logs in some days! i publish a setpoint at its startposition (offset groundtruth to local frame) with 8m altitude. this works fine. when it reaches its position it sets the setpoint 20m in x. it flies to this position but it goes crazy high. my rosbag tells me around 8m all the way and when it reaches its setpoint it makes a huge jump with correct altitude and comes down (or jumps in safetymode because of geofence). my lidar is fixed on the downside of the frame.

i logged in via mavproxy.py and used nsh to test ll40ls driver. i get good values but it returns “ERROR Pass”

Hi @tumbili, I am having similar troubles with ll40ls used as primary source of information in the height estimation process.
In particular, I have a drift problem in the height estimation, and after lot of flight tests (copter driven by RC in ALT mode and even moved manually with/without arming the system) my feeling is that the range finder is not used by the EKF2 for some reason (the most likely for consistency check).
Have you got any idea about how to solve the problem?
Here the original post in the forum: Altitude tracking drift in Altitude mode
I am available for any further clarification.