Servers by jDrones

Altitude drop with LidarLite


(Javier Cerna) #1

Hi, I’ve installed the Lidar Lite and its measurements are accurate enough for me. However, I was flying in Alt. Hold above a football goal post, when the altitude dropped really fast. I had to increase the throttle stick and move it away from the post. The goal post is like this one:

After repeating the same flight several times, I noticed I first had a drop in the lidar altitude (which makes sense, since it moves from 5.5 m to about 3 m), but I was expecting the copter to go high to mantain the desired altitude of 5.5 m. Instead, the copter went down as if the desired altitude was now 3 m.

Checking the log I have the same behavior:

As you can see, when the Lidar measures 3 m (SAlt), the Desired Sonar Alt becomes 3 m. Then, the copter desired alt also starts going down (along with the copter Alt) trying to reach the DSAlt value. Does this make sense?

How is the DSAlt moving because the SAlt drops? Shouldn’t it try to maintain the DSAlt by increasing the DAlt?

I’m attaching the bin file.


Bin file

(Javier Cerna) #2


Has anyone an insight on this? I’m really worried, since it should’nt affect Auto flights, but when I fly in Alt. Hold or Loiter, this is going to be problematic.

Thanks a lot in advance!

(ACPUK) #3

This is how lidar I is supposed to work. It’s used for terrain following. I.e the desired altitude is set to 3 m above terrain. So the gole posts must be 2.5 m tall. The lidar is detecting them and increasing the desaltitude to 5.5 m I.e about 3 m above the gole post. This is a pinpoint measurement from the top bar and if you move off this point it will measure from the ground there for will reduce desaltitude back to 3 m.

(Javier Cerna) #4

Thanks, that’s what I would expect too. However, you can see that instead of going up to keep 3 m, it goes down. I don’t understand this behavior. If I hadn’t moved the copter, it seemed like it would’ve crashed.

(Hu Jinhua) #5

It is really werid. If the copter was in terrain following mode ,the DSAlt param should be a const value unless the throttle stick moved. If you can post your log file here ,maybe I can sole the problem.

(Javier Cerna) #6

Sure. The bin file is in the first post, but I’ll attach it here again, just in case.

Bin file

(Hu Jinhua) #7

I am sorry,I cannot download the bin file from your link.As you know,there is something like wall on the Internet in china.

(Noppawit L.) #8

I think I can explain.
The logic of using rangefinder in Auto flight mode and Loiter/Alt Hld is not the same.

In Auto mode, you input a fixed height from terrain: ex 3 meters. Copter will ALWAYS keep 3 m. from the height it read.
At time = 0s your copter is flying on a field, it is 3 m. above the floor.
At time = 2s your copter fly over a roof of a house which is 2.5m high, copter will climb to 5.5 m. to keep it height (3m from terrain).

In Alt Hld/Loiter, It will keep the copter at the same height if you do not give input to your throttle stick. HOWEVER, It has a defined value called RANGEFINDER_GLITCH_ALT_CM (not a parameter, but defined in the code) (see in ArduCopter/Attitude.cpp) which is set to 200 cm or 2 m. Which mean if the next reading of the rangefinder has a difference of more than 2m it will be detected as a glitch, however, if this reading repeats for certain seconds, it will record this as new target altitude. For example
At time = 0s your copter is flying on a field, it is 3 m. above the floor.
At time = 2s your copter fly over a roof of a house which is 2.5m high, copter will maintain its height at 3 m above ground. so, the desired sonar (rangefinder) altitude is reduced to 0.5 m (from the reading (rooftop)).

In your case, the first drop in DSAlt (green) is due to the reading that has a difference more than 2 m. for certain readings (blue), then the reading jumps up, and differences is more than 2m so, DSAlt goes up. After that, it happens again.

I hope this help clarify your problem.

(Javier Cerna) #9

Actually, it’s the opposite way. In Auto mode, by default it won’t use the sonar altitude (I guess I have to set some parameters related to terrain following). However, both in Alt Hold/Loiter, the copter climbs to keep the desired height, which is was I was expecting in my original post.

What I think happened is that when the object is too narrow, the correction will take a couple of seconds to occur, giving the impression that the copter is going down abruptly, when in reality it would eventually correct its altitude. I have two flight logs that prove this behavior, both in Alt. Hold/Loiter and Auto modes.

Thanks a lot anyway! Your answer made me check a bit more. For anyone interested I have attached my flight logs.