SITL range finder always zero


I have added a range finder to SITL, as described here. The rangefinder.distance value, which was not displayed before by QGroundControl is displayed now, but it is constant at 0, as is rangefinder.voltage.

APM: APM:Copter V3.5.5 (27229c83)
APM: Frame: QUAD

What am I missing?


I followed those instructions and got a rangefinder. Did you reboot SITL?

Hi Peter,

yes I did, and I do have a range finder now… it’s just not doing any range finding :wink:

I might have messed up some other parameters though, and QGC will not reset them to defaults… (“Store parameters not supported”, argh)

Could you maybe share your params file so I can take a diff? I have attached mine.

apm-sitl-3.5.5-rngfnd.param (24.3 KB)

Thank you.

Ah OK, I found out what was wrong. I have been floored again :slight_smile:

SITL uses map terrain data to simulate the ground, and I just had placed my vehicle “beneath the floor” in the locations file. I just needed to climb higher than that.

After removing absolute-altitude,heading everything works as expected.

Are the values always zero, then?

Your parameter values certainly match the documentation.

I wonder if the values you’re looking at are coming from DISTANCE_SENSOR
rather than RANGEFINDER.

QGC has a facility to look at packets from the autopilot - “mavlink
inspector”, I think.

Have a look through the messages and see if RANGEFINDER is present with
sensible values…


Thank you, but I already figured it out, see above.

Edit: I probably should have edited the first post, instead of double posting… my bad.