Home › Guide › ArduPilot
Using a laser rangefinder with ArduPilot: the parameters that actually matter
Most integration failures are not the sensor. They are orientation, min/max limits, scaling, or expecting a rangefinder to replace an altitude source it cannot replace. This is the short list we would check on any ArduPilot build.
1. Get the sensor described correctly first
| Parameter | What it does | Where people go wrong |
|---|---|---|
RNGFND1_TYPE | Driver for the attached device | Picking a driver that matches the protocol but not the frame format — the module answers, the
parser reads garbage. If your module speaks a generic serial protocol, the serial/UART driver plus a
correct SERIALx_PROTOCOL setting is usually the honest choice. |
RNGFND1_ORIENT | Which way the beam points | 25 = down, 0 = forward, and so on. Wrong orientation does not fail loudly: the EKF simply receives distances that contradict the rest of the solution and gets rejected, or worse, accepted when they happen to fit. |
RNGFND1_MIN_CM / RNGFND1_MAX_CM | The window the autopilot will trust | Leaving MAX_CM wider than the module can actually reach means the EKF occasionally
accepts a bad return at long range. Set it to what the module really does on your target, not to the
datasheet headline. |
RNGFND1_GNDCLEAR | Height of the sensor above the ground when landed | Used to sanity-check zero. Wrong value produces a constant altitude offset that looks like EKF drift. |
RNGFND1_SCALING | Multiplier applied to the raw distance | Only needed for analog sensors in most builds. Leaving it non-1 on a digital module turns a correct measurement into a wrong one. |
2. Can a rangefinder be the only altitude source?
Mechanically yes — EK3_SRC1_POSZ = 2 selects the rangefinder as the position-Z
source. Whether it is a good idea is a different question, and it depends on the terrain:
- Over flat ground (a hall, a field, a runway) a downward rangefinder gives a very good height-above-ground estimate, far better than a barometer.
- Over sloping or stepped terrain the measurement is height above whatever the beam hits — a wall, a roof, a vehicle. The estimator has no way to know, and the vehicle follows the terrain profile.
- Horizontal position and velocity still need another source. Rangefinder-only Z does not replace GPS or optical flow for X/Y; if you have switched those off, you have removed the aiding the EKF needs to keep the attitude/position solution consistent.
3. The parameter people mix up with it
EK3_RNG_USE_HGT is not a source selector. It is a switch height expressed as
a percentage of the rangefinder's maximum range: it tells the EKF to start using the rangefinder for
height once the vehicle is below that fraction, while another source remains the primary altitude
reference — typically during landing. Set it to −1 and the rangefinder is not used that way at
all.
EK3_SRC1_POSZ = 2 makes the rangefinder the
altitude source (flat-ground use). EK3_RNG_USE_HGT only governs the "blend it in near
the ground" behaviour when something else is primary. They are not alternatives to each other.4. What the module brings to this
A 905 nm module in the 10–100 m class is the usual choice for landing assistance and low-altitude hold: small, light, 20–200 Hz, centimetre-class resolution. A 1535 nm module is the wrong tool here — you are paying for kilometres of reach you will never use, and the 0.5–10 Hz update rate is worse for a control loop.
If the same airframe also needs terrain or target ranging at hundreds of metres, use two sensors
with two driver instances (RNGFND1_* for the downward short-range unit,
RNGFND2_* for the long-range one) rather than compromising one.
5. If it does not work, check in this order
- Raw distance visible at all? Check wiring, baud,
SERIALx_PROTOCOL, and that the module is not in a triggered-only mode. - Raw distance plausible when pointed at a wall at a known distance? If not, it is scaling, units or the wrong driver.
- Sign/orientation correct? Point it at the ceiling: the number should change the way the autopilot expects.
- Does the EKF accept it? Watch for range-finder innovations being rejected — that is usually MIN/MAX too wide, orientation wrong, or the measurement contradicting a bad barometer offset.
- Only then look at the module's own accuracy and update rate.
Parameter names follow ArduPilot's Copter documentation; behaviour described is the documented intent, not a substitute for testing your build. ArduPilot is a separate open-source project; we are not affiliated with it.