Files
PX4-Autopilot/docs/zh/sensor/rangefinders.md
T

351 lines
22 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 距离传感器(测距仪)
Distance sensors provide distance measurement that can be used for [terrain following](../flying/terrain_following_holding.md#terrain_following), [terrain holding](../flying/terrain_following_holding.md#terrain_hold) (i.e. precision hovering for photography), improved landing behaviour ([conditional range aid](../advanced_config/tuning_the_ecl_ekf.md#conditional-range-aiding)), warning of regulatory height limits, collision prevention, etc.
This section lists the distance sensors supported by PX4 (linked to more detailed documentation), and provides information about the [generic configuration](#configuration) required for all rangefinders, [testing](#testing), and simulation with [Gazebo](#gazebo-simulation) or [Gazebo-Classic](#gazebo-classic-simulation).
更详细的设置和配置信息在下方(和侧边栏)的主题链接中提供
<img src="../../assets/hardware/sensors/lidar_lite/lidar_lite_v3.jpg" alt="LIDAR-Lite v3" width="200px" /><img src="../../assets/hardware/sensors/lidar_lightware/sf11c_120_m.jpg" alt="LightWare SF11/C Lidar" width="200px" /><img src="../../assets/hardware/sensors/optical_flow/ark_flow_distance_sensor.jpg" alt="ARK Flow" width="200px">
## 支持的测距仪
:::tip
This is a subset of the rangefinders that can be used with PX4.
[Modules: Distance Sensors](../modules/modules_driver_distance_sensor.md) lists PX4 drivers for other non-CAN rangefinders.
There may also be other DroneCAN rangefinders than those listed here.
:::
| Rangefinder | Technology | Range (min – max) | Connections | NDAA | 备注 |
| ------------------------------------------- | ---------------------------------- | ------------------------------------------------------------- | ---------------- | ----------------- | ------------------------------------------------------ |
| [Ainstein US-D1 Standard Radar Altimeter] | Microwave radar | 0.5 m – 50 m | UART | ✔️ | All-weather, works over water |
| [ARK DIST SR] | ToF (850 nm IR) | 8 cm to ~30 m | DroneCAN, UART | ✔️ | |
| [ARK DIST MR] | ToF (IR) | 8 cm to ~50 m | DroneCAN, UART | ✔️ | |
| [Benewake TFmini Plus] | ToF (IR LED) | 0.1 m – 12 m | UART | ~ | PX4 minimum 0.1 m |
| [Benewake TFmini-S] | ToF (IR laser) | 0.1 m – 12 m | UART | ~ | PX4 minimum 0.4 m |
| [Garmin LIDAR-Lite v3] | ToF (IR laser) | up to 40 m | I2C, PWM | ~ | PX4 caps range to 35 m or less |
| [Holybro ST VL53L1X Lidar] | ToF (IR) | up to ~4 m | I2C | ~ | |
| [LeddarOne] | ToF (IR) | 1 cm – 40 m | UART | ~ | |
| [LightWare SF11/C] | ToF (IR laser) | up to ~120 m | UART, I2C | ~ | |
| [LightWare LW20/C] | ToF (IR laser) | up to ~100 m | I2C | ~ | Waterproof (IP67) + servo |
| [LightWare SF45/B] | ToF (IR laser) | ~50 m | UART | ~ | Rotary lidar (collision prevention) |
| [MaxBotix I2CXL-MaxSonar-EZ] | Ultrasonic | | I2C | ~ | |
| [RaccoonLab Cyphal & DroneCAN µRANGEFINDER] | ToF (IR) | ~0.1 m – ~8 m | DroneCAN, Cyphal | ~ | |
| [Sony AS-DT1] | ToF | up to 40 m | UART | ~ | Multipoint distance sensor |
| [LightWare SF02] _(disc.)_ | ToF (IR laser) | ~50 m | UART | ~ | Discontinued |
| [LightWare SF10/A] _(disc.)_ | ToF (IR laser) | ~25 m | UART, I2C | ~ | Discontinued |
| [LightWare SF10/B] _(disc.)_ | ToF (IR laser) | ~50 m | UART, I2C | ~ | Discontinued |
| [LightWare SF10/C] _(disc.)_ | ToF (IR laser) | ~100 m | UART, I2C | ~ | Discontinued |
| [Lanbao PSK-CM8JL65-CC5] _(disc.)_ | ToF (IR) | 0.17 m – 8 m | UART | ✖️ | Discontinued |
| [Smartmicro Drone Altimeter] | Microwave radar | 1 m to 175 m | DroneCAN | ~ | |
| [TeraRanger Evo 60m] _(disc.)_ | ToF (IR) | 0.5 m – 60 m | I2C | ~ | Discontinued |
| [TeraRanger Evo 600Hz] _(disc.)_ | ToF (IR) | 0.75 m – 8 m | I2C | ~ | Discontinued |
| [TeraRanger Evo 3m] _(disc.)_ | ToF (IR) | 0.1 m – 3 m | I2C | ~ | Discontinued |
| [TeraRanger One] _(disc.)_ | ToF (IR) | 0.2 m – 14 m | I2C | ~ | Discontinued |
[Ainstein US-D1 Standard Radar Altimeter]: ../sensor/ulanding_radar.md
[ARK DIST SR]: ../dronecan/ark_dist.md
[ARK DIST MR]: ../dronecan/ark_dist_mr.md
[Benewake TFmini Plus]: ../sensor/tfmini.md
[Benewake TFmini-S]: ../sensor/tfmini.md
[Garmin LIDAR-Lite v3]: ../sensor/lidar_lite.md
[Holybro ST VL53L1X Lidar]: #holybro-st-vl53l1x-lidar
[Lanbao PSK-CM8JL65-CC5]: ../sensor/cm8jl65_ir_distance_sensor.md
[LeddarOne]: ../sensor/leddar_one.md
[LightWare Lidar]: ../sensor/sfxx_lidar.md
[LightWare SF11/C]: ../sensor/sfxx_lidar.md
[LightWare LW20/C]: ../sensor/sfxx_lidar.md
[LightWare SF45/B]: ../sensor/sfxx_lidar.md
[LightWare SF02]: ../sensor/sfxx_lidar.md
[LightWare SF10/A]: ../sensor/sfxx_lidar.md
[LightWare SF10/B]: ../sensor/sfxx_lidar.md
[LightWare SF10/C]: ../sensor/sfxx_lidar.md
[MaxBotix I2CXL-MaxSonar-EZ]: #maxbotix-i2cxl-maxsonar-ez
[Smartmicro Drone Altimeter]: ../dronecan/smartmicro_t132.md
[Sony AS-DT1]: ../sensor/sony_asdt1.md
[TeraRanger Evo 60m]: ../sensor/teraranger.md
[TeraRanger Evo 600Hz]: ../sensor/teraranger.md
[TeraRanger Evo 3m]: ../sensor/teraranger.md
[TeraRanger One]: ../sensor/teraranger.md
These adaptors allows you to connect a non-CAN rangefinder via the CAN interface.
Note that the range depends on the connected rangefinder
| Adaptor | Connections | NDAA |
| ------------------------------------------------------- | ---------------- | ----------------- |
| **Avionics Anonymous UAVCAN Laser Altimeter Interface** | DroneCAN | ~ |
| [RaccoonLab Cyphal & DroneCAN Rangefinder Adapter] | DroneCAN, Cyphal | ~ |
[RaccoonLab Cyphal & DroneCAN µRANGEFINDER]: #raccoonlab-cyphal-and-dronecan-μrangefinder
[RaccoonLab Cyphal & DroneCAN Rangefinder Adapter]: #raccoonlab-cyphal-and-dronecan-rangefinder-adapter
Note that some [Optical Flow](../sensor/optical_flow.md) sensors also include a rangefinder, such as [ARK Flow](../dronecan/ark_flow.md) and [ARK Flow MR](../dronecan/ark_flow_mr.md).
### ARK DIST SR & ARK DIST MR
[ARK DIST SR](../dronecan/ark_dist.md) and [ARK DIST MR](../dronecan/ark_dist_mr.md) are open-source Time-of-Flight (ToF) rangefinder modules, which are capable of measuring distances from 8cm to 30m and from 8cm to 50m, respectively.
The sensors support [DroneCAN](../dronecan/index.md), run [PX4 DroneCAN Firmware](../dronecan/px4_cannode_fw.md), and are packed into a tiny form factor.
They can be connected to a flight controller via its `CAN1` port, allowing additional sensors to connected through the `CAN2` port.
### Holybro ST VL53L1X 激光雷达
The [VL53L1X](https://holybro.com/products/st-vl53l1x-lidar) is a state-of-the-art, Time-of-Flight (ToF), laser-ranging sensor, enhancing the ST FlightSense™ product family.
它是市场上速度最快的微型 ToF 传感器,精确测距可达 4 m,快速测距频率可达 50 Hz。
It comes with a JST GHR 4 pin connector that is compatible with the I2C port on [Pixhawk 4](../flight_controller/pixhawk4.md), [Pixhawk 5X](../flight_controller/pixhawk5x.md), and other flight controllers that follow the [Pixhawk Connector Standard](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-009%20Pixhawk%20Connector%20Standard.pdf).
### Garmin LIDAR-Lite
The [Garmin LIDAR-Lite v3](../sensor/lidar_lite.md) is a compact laser time-of-flight rangefinder with a range of up to 40 m (PX4 caps this to 35 m or less).
It can be connected to either I2C or PWM ports.
### MaxBotix I2CXL-MaxSonar-EZ
The MaxBotix [I2CXL-MaxSonar-EZ](https://maxbotix.com/collections/i2cxl-maxsonar-ez-products) range has a number of relatively short-ranged sonar based rangefinders that are suitable for assisted takeoff/landing and collision avoidance.
这些可以使用 I2C 端口连接。
The rangefinders are enabled using the parameter [SENS_EN_MB12XX](../advanced_config/parameter_reference.md#SENS_EN_MB12XX).
### Lightware LIDARs
[Lightware SFxx Lidar](../sensor/sfxx_lidar.md) provide a broad range of lightweight “laser altimeters” that are suitable for many drone applications.
PX4 支持: SF11/c 和 SF/LW20.
PX4 也可用于一下停产的型号: SF02, SF10/a, SF10/b, SF10/c.
Others may be supported via the [RaccoonLab Cyphal and DroneCAN Rangefinder Adapter](#raccoonlab-cyphal-and-dronecan-rangefinder-adapter) described below.
PX4 also supports the [LightWare LiDAR SF45 Rotating Lidar](../sensor/sf45_rotating_lidar.md) for [collision prevention](../computer_vision/collision_prevention.md) applications.
### Sony AS-DT1
[Sony AS-DT1](../sensor/sony_asdt1.md) is a multipoint distance sensor that connects to PX4 over a UART/serial port.
PX4 configures the sensor baud rate and measurement output from the driver.
### TeraRanger 测距仪
<Badge type="info" text="Discontinued" />
[Terabee TeraRanger](../sensor/teraranger.md) sensors are small, lightweight rangefinders based on infrared Time-of-Flight (ToF) technology, with maximum ranges from 3 m to 60 m (depending on the model).
PX4 supports the following models connected via the I2C bus: TeraRanger Evo 60m, TeraRanger Evo 600Hz, TeraRanger Evo 3m and TeraRanger One.
### Ainstein US-D1 标准雷达高度计
The [Ainstein US-D1 Standard Radar Altimeter](../sensor/ulanding_radar.md) is a compact microwave radar rangefinder with a range of 0.5 m to 50 m and a 100 Hz update rate.
It can operate effectively in all weather conditions and over all terrain types (including water).
It must be connected to a UART/serial bus.
### LeddarOne
[LeddarOne](../sensor/leddar_one.md) 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.
### Benewake TFmini LiDAR
The [Benewake TFmini](../sensor/tfmini.md) LiDAR rangefinders (TFmini-S and TFmini Plus) have a range of 0.1–12 m and connect to a serial port (UART).
### PSK-CM8JL65-CC5
<Badge type="info" text="Discontinued" />
The [Lanbao PSK-CM8JL65-CC5 ToF Infrared Distance Measuring Sensor](../sensor/cm8jl65_ir_distance_sensor.md) 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.
### Smartmicro Drone Altimeter
The [Smartmicro Drone Altimeter](../dronecan/smartmicro_t132.md) is a [DroneCAN](../dronecan/index.md) radar-based altimeter with a sensing range of 1m to 175m.
It is designed for use in GNSS-denied environments.
### Avionics Anonymous UAVCAN Laser Altimeter Interface
The [Avionics Anonymous UAVCAN Laser Altimeter Interface](../dronecan/avanon_laser_interface.md) allows several common rangefinders (e.g. [Lightware SF11/c, SF30/D](../sensor/sfxx_lidar.md), etc) to be connected to the [CAN](../can/index.md) bus via [DroneCAN](../dronecan/index.md), a more robust interface than I2C.
### RaccoonLab Cyphal and DroneCAN Rangefinder Adapter
The [RaccoonLab Cyphal and DroneCAN Rangefinder Adapter](https://docs.raccoonlab.co/guide/rangefinder/) allows several common rangefinders to be connected to the CAN bus via Cyphal or DroneCAN, providing a more robust interface than I2C or UART.
This adapter efficiently reads measurements via I2C or UART and publishes range data in meters, making it a versatile solution for UAVs, robotics, and technical documentation applications.
Supported rangefinders include:
- LightWare LW20/C
- TF-Luna
- Garmin Lite V3
- VL53L1CB
### RaccoonLab Cyphal and DroneCAN µRANGEFINDER
[RaccoonLab µRANGEFINDER](https://docs.raccoonlab.co/guide/rangefinder/uRANGEFINDER.html) is designed to measure distance and publish it via Cyphal/DroneCAN protocols.
It can be used to estimate precision landing or object avoidance.
Features:
- [VL53L1CBV0FY-1](https://www.st.com/resource/en/datasheet/vl53l1.pdf) sensor
- Input voltage sensor
- CAN connectors: 2 [UCANPHY Micro (JST-GH 4)](https://docs.raccoonlab.co/guide/wires/).
## Configuration/Setup {#configuration}
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.
### Generic Configuration
The common rangefinder configuration is specified using [EKF2_RNG\_\*](../advanced_config/parameter_reference.md#EKF2_RNG_CTRL) parameters.
These include (non exhaustively):
- [EKF2_RNG_POS_X](../advanced_config/parameter_reference.md#EKF2_RNG_POS_X), [EKF2_RNG_POS_Y](../advanced_config/parameter_reference.md#EKF2_RNG_POS_Y), [EKF2_RNG_POS_Z](../advanced_config/parameter_reference.md#EKF2_RNG_POS_Z) - offset of the rangefinder from the vehicle centre of gravity in X, Y, Z directions.
- [EKF2_RNG_PITCH](../advanced_config/parameter_reference.md#EKF2_RNG_PITCH) - 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.
- [EKF2_RNG_DELAY](../advanced_config/parameter_reference.md#EKF2_RNG_DELAY) - approximate delay of data reaching the estimator from the sensor.
- [EKF2_RNG_SFE](../advanced_config/parameter_reference.md#EKF2_RNG_SFE) - Range finder range dependent noise scaler.
- [EKF2_RNG_NOISE](../advanced_config/parameter_reference.md#EKF2_RNG_NOISE) - Measurement noise for range finder fusion
### Health Reporting
PX4 reports the rangefinder status to ground stations in the [SYS_STATUS](https://mavlink.io/en/messages/common.html#SYS_STATUS) message, using the `MAV_SYS_STATUS_SENSOR_LASER_POSITION` bit (this bit is used for all distance sensor types, not just lasers):
- `onboard_control_sensors_present`: set once any distance sensor has published data.
- `onboard_control_sensors_health`: cleared if a required distance sensor is missing or stops providing valid data (no update for more than 1 second).
The required distance sensors are the first [SYS_HAS_NUM_DIST](../advanced_config/parameter_reference.md#SYS_HAS_NUM_DIST) sensors.
For example, with `SYS_HAS_NUM_DIST` set to 2 and three sensors connected, only the first two affect the health bit.
A required sensor that fails also blocks arming.
WARNING : `SYS_HAS_NUM_DIST` is `0` by default, which means no distance sensor is required.
The health bit is then always reported as healthy, even if a rangefinder stops working.
Set `SYS_HAS_NUM_DIST` if you want rangefinder failures to be reported.
You can check these bits in the `SYS_STATUS` message using the [QGroundControl MAVLink Inspector](#qgroundcontrol-mavlink-inspector).
## 测试
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.
### QGroundControl MAVLink Inspector
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.
:::info
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:
1. Open the menu **Q > Select Tool > Analyze Tools**:
![Menu for QGC Analyze Tool](../../assets/qgc/analyze/menu_analyze_tool.png)
2. Select the message `DISTANCE_SENSOR`, and then check the plot checkbox against `current_distance`.
The tool will then plot the result:
![QGC Analyze DISTANCE_SENSOR value](../../assets/qgc/analyze/qgc_analyze_tool_distance_sensor.png)
### QGroundControl MAVLink Console
You can also use the _QGroundControl MAVLink Console_ to observe the `distance_sensor` uORB topic:
```sh
listener distance_sensor 5
```
:::info
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.
:::
For more information see: [Development > Debugging/Logging > Sensor/Topic Debugging using the Listener Command](../debug/sensor_uorb_topic_debugging.md).
## 仿真
### Gazebo Simulation
Lidar and sonar rangefinders can be used in the [Gazebo](../sim_gazebo_gz/index.md) simulator.
To do this you must start the simulator using a vehicle model that includes the rangefinder.
Downward facing sensors that write to the [DistanceSensor](../msg_docs/DistanceSensor.md) UORB topic can be used to test use cases such as [landing](../flight_modes_mc/land.md) and [terrain following](../flying/terrain_following_holding.md):
- [Quadrotor(x500) with 1D LIDAR (Down-facing)](../sim_gazebo_gz/vehicles.md#x500-quadrotor-with-1d-lidar-down-facing)
```sh
make px4_sitl gz_x500_lidar_down
```
Front-facing sensors that write to [ObstacleDistance](../msg_docs/ObstacleDistance.md) can be used to test [Collision Prevention](../computer_vision/collision_prevention.md#gazebo-simulation):
- [Quadrotor(x500) with 2D LIDAR](../sim_gazebo_gz/vehicles.md#x500-quadrotor-with-2d-lidar)
```sh
make px4_sitl gz_x500_lidar_2d
```
- [Quadrotor(x500) with 1D LIDAR (Front-facing)](../sim_gazebo_gz/vehicles.md#x500-quadrotor-with-1d-lidar-front-facing)
```sh
make px4_sitl gz_x500_lidar_front
```
### Gazebo-Classic Simulation
Lidar and sonar rangefinders can be used in the [Gazebo Classic](../sim_gazebo_classic/index.md) simulator.
To do this you must start the simulator using a vehicle model that includes the rangefinder.
The iris optical flow model includes a Lidar rangefinder:
```sh
make px4_sitl gazebo-classic_iris_opt_flow
```
The typhoon_h480 includes a sonar rangefinder:
```sh
make px4_sitl gazebo-classic_typhoon_h480
```
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:
- [iris_opt_flow.sdf](https://github.com/PX4/PX4-SITL_gazebo-classic/blob/main/models/iris_opt_flow/iris_opt_flow.sdf)
```xml
<include>
<uri>model://lidar</uri>
<pose>-0.12 0 0 0 3.1415 0</pose>
</include>
<joint name="lidar_joint" type="revolute">
<child>lidar::link</child>
<parent>iris::base_link</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>
```
- [typhoon_h480.sdf](https://github.com/PX4/PX4-SITL_gazebo-classic/blob/main/models/typhoon_h480/typhoon_h480.sdf.jinja#L1131-L1145)
```xml
<include>
<uri>model://sonar</uri>
</include>
<joint name="sonar_joint" type="revolute">
<child>sonar_model::link</child>
<parent>typhoon_h480::base_link</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>
```