Skip to content

Conversation

@robertlong13
Copy link
Collaborator

@robertlong13 robertlong13 commented Jan 2, 2026

The RANGEFINDER message will no longer be sent by default in ArduPilot (and will eventually be removed). ArduPilot/ardupilot#31095

This is the message that populates the sonarrange field, which is different from the rangefinder[N] fields in that it explicitly uses alt units (since it's explicitly known ahead of time that this message is for downfacing rangefinders only). As an asside, sonarrange should probably get renamed to something like rangefinderalt, but that would break some setups and is out of scope for this PR. Not sure how we want to approach that.

This PR falls back to taking populating the sonarrange with the first downward-facing rangefinder in the DISTANCE_SENSOR message if no RANGEFINDER messages are coming in (it will continue to prefer RANGEFINDER if it's receiving it).

There is a subtle difference with using the first downward rangefinder. The value that ArduPilot sends in RANGEFINDER is actually the first downward facing range finder that is in range, but then if none are in range, it returns the first downward facing one. That would be much messier to implement, and the vast majority of people just have the single downward sensor. I say with go with this implementation for now. This is why I have Planner prefer the deprecated message. If anyone hits an issue, they can work around it temporarily by enabling the RANGEFINDER message (which will still be compiled in by default in 4.7, just not sent by default).

I've tested this in SITL with both messages, and with each on their own. I tested that the priority between the two messages is working, and I tested with multiple rangefinders in different orientations, and I tested with different unit settings in Planner. All working as expected.

The RANGEFINDER message is about to be deprecated
Copy link
Collaborator

@EosBandi EosBandi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in SITL and on a Cube with multiple rangefinders.
It is working just fine.

@meee1 meee1 merged commit 20745db into ArduPilot:master Jan 14, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants