Altitude estimation with Lidar v3.6.6 [SOLVED]


I have a problem with the altitude evaluation. I want to use only my Lidar (Lidar-Lite v3, in PWM mode) as my primary source of altitude pose. I’m in indoor environment, where I don’t use GPS.

I used to have the firmware 3.5.7, and there were no problem (Stabilization with the lidar was perfect, with few centimeters of error).

I recently upload the new firmware 3.6.6 into my Pixhawk. With the same parameters as the previous one.
And now, I see the altitude going from 1m to -0.5 easily, with a lot of noise whereas I’m not moving at all. But when I check in mission planner the value of the Rangefinder, the precision is still the same and smooth.

So I think it’s comes from the integration of the lidar in the altitude estimation, and not from the lidar value itself (which are good). I’m using the EKF2.

Is there any big change about the use of the lidar for altitude estimation in this new firmware that I’m not aware of ?

I let here 2 logs (1 : with EK2_ALT_SOURCE 1, and 2 : with EK2_ALT_SOURCE 0 - I thought maybe the priority changed with this variable). (405.4 KB)

2019-02-20 16-29-26.tlog (568.7 KB) (It’s the last test (2), I’m limited in space upload, I will try to put all the logs on a drive)

And the corresponding parameters :
Pixhawk_Firmware_19.02.2019 (13.6 KB)

Thank you in advance for this reading, I tried to find some similar issue here, but not found it yet. I hope it’s something easy to handle !


I’m not aware of any changes in how the EKF is integrating the range finder values although I have also seen a lot of users having problems when setting the EK2_ALT_SOURCE = 1 (there was an issue yesterday here).

We do have a PR which will slightly improve the altitude estimate specifically for the PWM based lidar (which is what you’re using I think) but this affects the lidar readings directly (which you say are smooth).

I wonder if there’s a chance you could do back-to-back tests with Copter-3.5.x vs 3.6.6? Sorry for this but it would help us get to the solution more quickly I think

EDIT: as a side note, I quickly checked the .log file and they look very similar - in both logs I see small variations in altitude of about 20cm or so. Also it seems in both the EK2_ALT_SOURCE = 1 (RangeFinder).

Thank you for your quick reply !

I did the logs quickly, probably I mess up with the files. Where do you read the altitude value to see the 20cm variation ? (because when I check it in live through Mission Planner, I see the big noise).

If it’s the variable CTUN.Alt, I see a difference of 20cm like you, but in Mission Planner “altitude”, I see bigger fluctuation.

I’ve just upload the Copter-3.5.5, and the altitude is smooth (even without Lidar and only with barometer).

So, I’m not an expert, but in my opinion with the new firmware :

  • The altitude estimated through the barometer is wrong
  • (And/Or) The integration of lidar in the position in not done well

Do we have to do some calibration when uploading a new firmware or keeping the same value as the previous one is ok because we use the same hardware ?

The logs :
4 01-01-2000 01-22-16.bin (335.4 KB)

With the same parameter, this is the difference in altitude (for a drone which is stable, not flying, just on the desk) :
Normal behavior with Copter 3.5.5 :

Strange behavior with Copter 3.6.6 : (The altitude supposed to be constant)

From the last test I’ve done, I think the display of the altitude in Mission Planner is wrong. Because after analysing the logs, the altitude seems quite ok (I just change the altitude “by hand”, not during flight) :
2 01-01-1970 01-00-00.bin (687.3 KB)

I will try it for a flight, and let you know about it

1 Like

Hello ,i need to use drone in low altitude with lidar , i use TFmini sensor like Altitude source , but doest not work the sonar range value is correct but EKF2 altitude is like is baro value ,not precised not stable and can go to negative ,something has changed in the new version but fot what raison !? how can i use the lidar like primary altitude source .

Hi @Tarek-H,

I recommend you to check my answer on another topic :

Hi ,
I can’t see the solution ! of course I already use EK2_ALT_SOURCE = 1 ,. EK2_RNG_USE_HGT=70 , normally is only the range finder value ,but it is not ! is like is baro value for me ; i use TFmini Lidar and the range finder value is correct !
for my experience ,before i used 3.6-dev version with lidar_lite_v3 , it work very well EKF_ALtitude= Range finder value , Now I have my lidar_lite broken , i use New arducopter version with TFmini added ,but EKF_ALtitude is différent .

All right. I recommand you to create a topic for this specific problem, and provide the logs and a full description of your problem :slight_smile:
I’m sure people can help you. Like this, I don’t know how to help you, I never used this range finder.

Good luck !

ok i will do , so you resolve the problem ! you use Copter 3.6.6 v ,Lidar lite V3 ,only do EK2_ALT_SOURCE = 1 , EK2_RNG_USE_HGT = 70 ,and the EKF altitude is equal lidar Altitude !?

Yes, in my case, it works with EK2_ALT_SOURCE = 0, EK2_RNG_USE_HGT = 70. The source of the altitude was the Lidar.

Hi! Im trying to use TF-mini S as the main source of altitude data for pixhawk. The rangefinder (sonarrange) shows the values correctly, but altitude always shows unstable values in the range from -2 to 2 - and these values do not coincide at all with the lidar values. I perfomed all the actions from the topic - it didn’t work. Please tell me what can be done with this