The rangefinder's input pin is not set, or cannot be used
What ArduPilot says:
- RNGFNDN_PIN=N, set SERVON_FUNCTION=-1
- RNGFNDN_PIN not set
- RNGFNDN_PIN=N invalid
An analog rangefinder (RNGFNDn_TYPE 1) or a PWM one (5 or 22) is read through a pin of the flight controller, named by RNGFNDn_PIN. “not set” means the parameter is still -1. A PWM sensor also needs the pin to be a free GPIO (a general-purpose pin): “invalid” means this board has no pin with that number, and “set SERVOn_FUNCTION=-1” means the pin is a servo/motor output that still works as an output.
What to do, most likely first
The sensor is not analog or PWM at all: a serial or I2C lidar was given the wrong type.
CheckTypes 1, 5 and 22 are only for sensors that give a voltage or a pulse width on one signal wire.
FixSet
RNGFNDn_TYPEto your sensor's own type (20 for a TFmini or TF-Luna on a UART) and reboot.RNGFNDn_PINwas never set.FixSet
RNGFNDn_PINto the pin the signal wire is on: an analog input number for an analog sensor, a GPIO number for a PWM one. Your board's ArduPilot documentation page lists both.The pin is one of the servo/motor outputs and is still set up as an output.
CheckThe message names the output: “set
SERVO9_FUNCTION=-1” is output 9.FixSet that
SERVOn_FUNCTIONto -1 (GPIO) and reboot: outputs become GPIO pins only at start-up. Nothing else (a motor, a servo) may be wired to that output.The pin number does not exist on this board: it was copied from another board's parameters.
FixUse a pin number from your own board's documentation; the numbers differ from board to board.
Parameters to look at
| Parameter | What it is |
|---|---|
RNGFND1_TYPE | Rangefinder type |
RNGFND1_PIN | Rangefinder pin |
RNGFND2_TYPE | Rangefinder type |
RNGFND2_PIN | Rangefinder pin |
SERVO9_FUNCTION | Servo output function |
SERVO10_FUNCTION | Servo output function |
Where to do it:Board & Wiring Planner
The code that sends it
RNGFNDN_PIN=N, set SERVON_FUNCTION=-1
libraries/AP_RangeFinder/AP_RangeFinder.cpp RangeFinder::prearm_healthy() · Open in ArduPilot Copter-4.7.1
RNGFNDN_PIN not set
libraries/AP_RangeFinder/AP_RangeFinder.cpp RangeFinder::prearm_healthy() · Open in ArduPilot Copter-4.7.1
RNGFNDN_PIN=N invalid
libraries/AP_RangeFinder/AP_RangeFinder.cpp RangeFinder::prearm_healthy() · Open in ArduPilot Copter-4.7.1