Distance Sensors (Rangefinders)
Last updated
Last updated
Distance sensors provide distance measurement that can be used for , (i.e. precision hovering for photography), improved landing behaviour (), warning of regulatory height limits, collision prevention, etc.
This section lists the distance sensors supported by PX4 (linked to more detailed documentation), the required for all rangefinders, , and information. More detailed setup and configuration information is provided in the topics linked below (and sidebar).
PX4 supports: SF11/c and SF/LW20. PX4 can also be used with the following discontinued models: SF02, SF10/a, SF10/b, SF10/c.
PX4 supports the following models connected via the I2C bus: TeraRanger One, TeraRanger Evo 60m and TeraRanger Evo 600Hz.
Rangefinders are usually connected to either a serial (PWM) or I2C port (depending on the device driver), and are enabled on the port by setting a particular parameter.
The hardware and software setup that is specific to each distance sensor is covered in their individual topics.
The generic configuration that is common to all distance sensors, covering both the physical setup and usage, is given below.
The easiest way to test the rangefinder is to vary the range and compare to the values detected by PX4. The sections below show some approaches to getting the measured range.
The QGroundControl MAVLink Inspector lets you view messages sent from the vehicle, including DISTANCE_SENSOR
information from the rangefinder. The main difference between the tools is that the Analyze tool can plot values in a graph.
:::note The messages that are sent depend on the vehicle configuration. You will only get DISTANCE_SENSOR
messages if the connected vehicle has a rangefinder installed and is publishing sensor values. :::
To view the rangefinder output:
Open the menu Q > Select Tool > Analyze Tools:
You can also use the QGroundControl MAVLink Console to observe the distance_sensor
uORB topic:
:::note The QGroundControl MAVLink Console works when connected to Pixhawk or other NuttX targets, but not the Simulator. On the Simulator you can run the commands directly in the terminal. :::
The iris optical flow model includes a Lidar rangefinder:
The typhoon_h480 includes a sonar rangefinder:
If you need to use a different vehicle you can include the model in its configuration file. You can see how in the respective Iris and Typhoon configuration files:
is an open-source Time-of-Flight (ToF) and optical flow sensor module, which is capable of measuring distances from 8cm to 30m. It can be connected to the flight controller via its CAN1 port, allowing additional sensors to connect through its CAN2 port. It supports , runs , and is packed into a tiny form factor.
The is a state-of-the-art, Time-of-Flight (ToF), laser-ranging sensor, enhancing the ST FlightSenseâ„¢ product family. It is the fastest miniature ToF sensor on the market with accurate ranging up to 4 m and fast ranging frequency up to 50 Hz.
It comes with a JST GHR 4 pin connector that is compatible with the I2C port on , , and other flight controllers that follow the ).
is a compact, high-performance optical distant measurement rangefinder. It has a sensor range from (5cm - 40m) and can be connected to either PWM or I2C ports.
The MaxBotix range has a number of relatively short-ranged sonar based rangefinders that are suitable for assisted takeoff/landing and collision avoidance. These can be connected using an I2C port.
The rangefinders are enabled using the parameter .
provide a broad range of lightweight "laser altimeters" that are suitable for many drone applications.
provide a number of lightweight distance measurement sensors based on infrared Time-of-Flight (ToF) technology. They are typically faster and have greater range than sonar, and smaller and lighter than laser-based systems.
The Ainstein is compact microwave rangefinder that has been optimised for use on UAVs. It has a sensing range of around 50m. A particular advantages of this product are that it can operate effectively in all weather conditions and over all terrain types (including water).
is small Lidar module with a narrow, yet diffuse beam that offers excellent overall detection range and performance, in a robust, reliable, cost-effective package. It has a sensing range from 1cm to 40m and needs to be connected to a UART/serial bus.
The is a tiny, low cost, and low power LIDAR with 12m range.
The is a very small (38 mm x 18mm x 7mm, <10g) IR distance sensor with a 0.17m-8m range and millimeter resolution. It must be connected to a UART/serial bus.
The allows several common rangefinders (e.g. , etc) to be connected to the bus via , a more robust interface than I2C.
The common rangefinder configuration is specified using parameters. These include (non exhaustively):
, , - offset of the rangefinder from the vehicle centre of gravity in X, Y, Z directions.
- A value of 0 degrees (default) corresponds to the range finder being exactly aligned with the vehicle vertical axis (i.e. straight down), while 90 degrees indicates that the range finder is pointing forward. Simple trigonometry is used to calculate the distance to ground if a non-zero pitch is used.
- approximate delay of data reaching the estimator from the sensor.
- Range finder range dependent noise scaler.
- Measurement noise for range finder fusion
Select the message DISTANCE_SENSOR
, and then check the plot checkbox against current_distance
. The tool will then plot the result:
For more information see: .
Lidar and sonar rangefinders can be used in the simulator. To do this you must start the simulator using a vehicle model that includes the rangefinder.