From 52cf5eebe1acddb8c8ce4fb8f8f4a8181bc95c84 Mon Sep 17 00:00:00 2001 From: jiakun <53556221+ddwolf87@users.noreply.github.com> Date: Thu, 5 Nov 2026 09:25:26 +0800 Subject: [PATCH] feat(tfmini): add TFMINI Plus variant and correct TFMINI FoV (#29575) The 2.3 degree FoV published for the TFMINI/TFMINI-S dates back to #24700 without a documented source and does not match the Benewake datasheet, which specifies 2 degrees. Publish the datasheet value so collision prevention and MAVLink consumers see an honest envelope. Add the TFMINI Plus as variant 4. It speaks the same protocol but has a 3.6 degree FoV and 0.1 m minimum range per the datasheet. Selecting the TFMINI variant for a Plus made PX4 discard all readings below 0.4 m (signal_quality forced to 0), starving EKF2 of range aiding in close-range use. Update the PX4 docs so the model table, reported ranges and out-of-range behaviour distinguish the two models. Bench-verified on px4_fmu-v6x with a TFMINI Plus: variant 1 reports h_fov 0.0349 rad and stamps quality 0 below 0.4 m; variant 4 reports h_fov 0.0628 rad, keeps quality -1 from 0.11 to 0.30 m and stamps quality 0 at 0.05 m. Fixes #29460 Assisted-by: GLM:glm-5.3-flash Signed-off-by: jiakun <53556221+ddwolf87@users.noreply.github.com> --- docs/en/sensor/rangefinders.md | 2 +- docs/en/sensor/tfmini.md | 14 +++++++------- src/drivers/distance_sensor/tfmini/TFMINI.cpp | 10 ++++++++-- src/drivers/distance_sensor/tfmini/module.yaml | 5 +++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/en/sensor/rangefinders.md b/docs/en/sensor/rangefinders.md index eacaa2abf52..71c46e23c66 100644 --- a/docs/en/sensor/rangefinders.md +++ b/docs/en/sensor/rangefinders.md @@ -20,7 +20,7 @@ There may also be other DroneCAN rangefinders than those listed here. | [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.4 m | +| [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 | ~ | | diff --git a/docs/en/sensor/tfmini.md b/docs/en/sensor/tfmini.md index a343073782a..27518b700e9 100644 --- a/docs/en/sensor/tfmini.md +++ b/docs/en/sensor/tfmini.md @@ -2,7 +2,7 @@ -The Benewake [TFmini-S](https://en.benewake.com/TFminiS/index_proid_325.html) and [TFmini Plus](https://en.benewake.com/TFminiPlus/index_proid_323.html) are small, low-power time-of-flight LiDAR [rangefinders](../sensor/rangefinders.md) with a range of 0.1–12 m (PX4 uses 0.4–12 m) and a 100 Hz default update rate. +The Benewake [TFmini-S](https://en.benewake.com/TFminiS/index_proid_325.html) and [TFmini Plus](https://en.benewake.com/TFminiPlus/index_proid_323.html) are small, low-power time-of-flight LiDAR [rangefinders](../sensor/rangefinders.md) with a range of 0.1–12 m and a 100 Hz default update rate. They connect to the flight controller using a serial port (UART). ![TFmini LiDAR](../../assets/hardware/sensors/tfmini/tfmini_hero.jpg) @@ -12,14 +12,14 @@ They connect to the flight controller using a serial port (UART). | Model | Range | Connection | `SENS_TFMINI_HW` value | | ---------------------------------------------------------------------- | -------- | ---------- | ---------------------- | | [TFmini-S](https://en.benewake.com/TFminiS/index_proid_325.html) | 0.1–12 m | UART | `1` (default) | -| [TFmini Plus](https://en.benewake.com/TFminiPlus/index_proid_323.html) | 0.1–12 m | UART | `1` (default) | +| [TFmini Plus](https://en.benewake.com/TFminiPlus/index_proid_323.html) | 0.1–12 m | UART | `4` | -PX4 reports distances from 0.4 m to 12 m for both models. +PX4 reports distances from 0.4 m to 12 m for the TFmini-S and from 0.1 m to 12 m for the TFmini Plus. ## Specifications {#specifications} - **Technology:** Time-of-flight, 850 nm infrared (VCSEL on the TFmini-S, LED on the TFmini Plus) -- **Range:** 0.1–12 m at 90% reflectivity; 0.1–7 m (TFmini-S) or 0.1–4 m (TFmini Plus) at 10% reflectivity (PX4 uses 0.4–12 m) +- **Range:** 0.1–12 m at 90% reflectivity; 0.1–7 m (TFmini-S) or 0.1–4 m (TFmini Plus) at 10% reflectivity - **Update rate:** 100 Hz by default, adjustable 1–1000 Hz - **Field of view:** 2° (TFmini-S), 3.6° (TFmini Plus) - **Accuracy:** ±6 cm below 6 m and ±1% from 6–12 m (TFmini-S); ±5 cm below 5 m and ±1% from 5–12 m (TFmini Plus) @@ -44,7 +44,7 @@ PX4 reports distances from 0.4 m to 12 m for both models. Mount the sensor facing down: PX4 assumes a downward-facing sensor, and the orientation cannot be configured. -Readings below 0.4 m are reported as out of range. +Readings below the minimum range of the selected model (0.4 m for the TFmini-S, 0.1 m for the TFmini Plus) are reported as out of range. ### Pinouts {#pinouts} @@ -114,7 +114,7 @@ The driver does not configure the sensor, so the sensor must be at its factory s If these have been changed, reset the sensor to its defaults as described in the Benewake user manual. [SENS_TFMINI_HW](../advanced_config/parameter_reference.md#SENS_TFMINI_HW) selects the model and sets the range limits PX4 reports. -Leave it at its default `1` (`TFMINI`) for the TFmini-S and TFmini Plus. +Set it to `1` (`TFMINI / TFMINI-S`) for the TFmini-S or `4` (`TFMINI Plus`) for the TFmini Plus. The configuration that is common to all rangefinders, such as the sensor position offsets used by the estimator, is covered in [Rangefinders > Configuration/Setup](../sensor/rangefinders.md#configuration). @@ -132,7 +132,7 @@ You can observe the published measurements with: listener distance_sensor ``` -The sensor type is reported as laser, with minimum and maximum distances of 0.4 m and 12 m. +The sensor type is reported as laser, with minimum and maximum distances of 0.4 m and 12 m for the TFmini-S, and 0.1 m and 12 m for the TFmini Plus. The measurements can also be viewed in the `DISTANCE_SENSOR` message in the _QGroundControl MAVLink Inspector_. For more information see [Rangefinders > Testing](../sensor/rangefinders.md#testing). diff --git a/src/drivers/distance_sensor/tfmini/TFMINI.cpp b/src/drivers/distance_sensor/tfmini/TFMINI.cpp index 1d620580448..d560f30b92b 100644 --- a/src/drivers/distance_sensor/tfmini/TFMINI.cpp +++ b/src/drivers/distance_sensor/tfmini/TFMINI.cpp @@ -77,7 +77,7 @@ TFMINI::init() param_get(param_find("SENS_TFMINI_HW"), &hw_model); switch (hw_model) { - case 1: // TFMINI (12m, 100 Hz) + case 1: // TFMINI / TFMINI-S (12m, 100 Hz) // Note: // Sensor specification shows 0.3m as minimum, but in practice // 0.3 is too close to minimum so chattering of invalid sensor decision @@ -85,7 +85,7 @@ TFMINI::init() // So we set 0.4 as valid minimum. _px4_rangefinder.set_min_distance(0.4f); _px4_rangefinder.set_max_distance(12.0f); - _px4_rangefinder.set_fov(math::radians(2.3f)); + _px4_rangefinder.set_fov(math::radians(2.0f)); break; case 2: // ISTRA24 (50m, 100 Hz) @@ -100,6 +100,12 @@ TFMINI::init() _px4_rangefinder.set_fov(math::radians(20)); break; + case 4: // TFMINI Plus (12m, 100 Hz) + _px4_rangefinder.set_min_distance(0.1f); + _px4_rangefinder.set_max_distance(12.0f); + _px4_rangefinder.set_fov(math::radians(3.6f)); + break; + default: PX4_ERR("invalid HW model %" PRId32 ".", hw_model); return -1; diff --git a/src/drivers/distance_sensor/tfmini/module.yaml b/src/drivers/distance_sensor/tfmini/module.yaml index daf1925b0c2..9bebadefbb6 100644 --- a/src/drivers/distance_sensor/tfmini/module.yaml +++ b/src/drivers/distance_sensor/tfmini/module.yaml @@ -14,10 +14,11 @@ parameters: long: Models differ in range and FoV. type: enum values: - 1: TFMINI + 1: TFMINI / TFMINI-S 2: ISTRA24 3: ISTRA24_100m + 4: TFMINI Plus min: 1 - max: 3 + max: 4 default: 1 reboot_required: true