benewake (4)

Real-time obstacle avoidance is a tricky problem for small autonomous drones. Onboard computing power is limited, but the aircraft still needs to detect obstacles and react quickly enough to avoid them.
Depth cameras are one way to approach the problem. They provide detailed spatial information that can be used for obstacle detection and environmental perception. But acquiring depth data is only part of the process. The system also needs to process that information and turn it into flight control decisions.
On a small drone running perception algorithms on something like a Raspberry Pi, that processing overhead matters.
A recent Nature paper, Efficient robot navigation inspired by honeybee learning flights, includes an interesting change in the researchers' obstacle avoidance hardware.
The team initially used an Intel RealSense D435i depth camera to detect obstacles. In later experiments, they switched to three Benewake TF-Nova LiDAR rangefinders, positioned to monitor the left, center, and right directions ahead of the drone.
The paper primarily focuses on a navigation method inspired by honeybee learning flights, rather than a direct comparison between depth cameras and LiDAR. Still, the change raises an interesting question:
If an obstacle avoidance algorithm only needs to know whether something is blocking a particular direction, does it really need to process an entire depth image?
31306676279?profile=RESIZE_710x

1. What Actually Changed When the Researchers Switched to LiDAR?

The researchers built a custom quadcopter using a Pixhawk 6C Mini running PX4 firmware for flight control, with a Raspberry Pi 4 handling onboard perception and higher-level navigation.
The platform also included an omnidirectional camera, an optical flow sensor, and a Benewake TFmini-S LiDAR rangefinder.
The TFmini-S provided altitude measurements to support motion estimation alongside optical flow and other sensor inputs. The omnidirectional camera supplied images for the visual homing system.
Obstacle avoidance was handled separately.
In the initial configuration, the researchers used an Intel RealSense D435i depth camera. The depth image was divided into three regions: left, center, and right.
The system calculated the average depth in each region to determine whether an obstacle was present and which direction appeared more open.
This is a fairly straightforward approach, but it still requires processing depth image data to extract the measurements used by the avoidance algorithm.
In later experiments, the team replaced this setup with three TF-Nova LiDAR rangefinders, each covering a 1° × 14° field of view.
One sensor monitored the left, another looked straight ahead, and the third covered the right.
Instead of extracting distances from different parts of a depth image, the avoidance algorithm could read directional distance measurements directly from the sensors.
That changes the type of information available to the controller.
A depth camera provides a much richer representation of the space ahead. Three directional LiDAR sensors provide considerably less information, but that may be sufficient when the algorithm only needs a few distance measurements.
Of course, this doesn't mean three LiDAR sensors are always more computationally efficient than a depth camera. Processing requirements depend on the camera hardware, how depth data is generated, the software implementation, and the overall system architecture.
In this particular reactive avoidance setup, however, direct range measurements eliminated the need to extract those distances from depth images.

2. How Can a Drone Avoid Obstacles with Just Three Distance Measurements?

The researchers used a finite-state machine (FSM) for reactive obstacle avoidance rather than building a detailed 3D map and planning a complete path around every obstacle.
The three TF-Nova sensors continuously measured distances in different directions ahead of the drone.
During normal flight, the system checked the forward distance against a predefined stopping threshold.
If an obstacle was detected within that threshold, the current navigation routine was interrupted and the avoidance controller took over.
The drone then used the left and right distance measurements to determine which direction offered a possible route around the obstacle.
For example, if the forward direction was blocked, the aircraft could rotate toward a clearer side and perform an avoidance maneuver.
If all three directions were blocked, the controller attempted a larger directional change to find another way through.
None of this required a complete 3D reconstruction of the surrounding environment.
The LiDAR sensors were not being used for mapping. Their job was to provide obstacle distance measurements that the controller could use to trigger specific avoidance actions.
There are obvious limitations to this approach.
Three directional sensors only cover a small portion of the space ahead. An obstacle located between the sensing regions could be missed entirely.
The stopping threshold also needs to be considered alongside the drone's actual flight dynamics.
At higher speeds, detecting an obstacle is not enough. The aircraft still needs sufficient time and distance to decelerate, stop, or change direction.
Sensor range, mounting angles, field of view, flight speed, and controller response time all affect how well the system performs.
For a relatively slow-moving drone operating in a controlled environment, directional range sensing may be sufficient for a simple avoidance strategy.
For faster flight or environments containing thin obstacles, dense vegetation, or irregular structures, three narrow sensing regions would leave significant gaps in coverage.

3. What Happens to Navigation After the Drone Avoids an Obstacle?

Another detail worth looking at is how the obstacle avoidance system interacts with the drone's higher-level navigation.
Bee-Nav was developed to investigate autonomous navigation and homing inspired by honeybee learning flights, without relying on a detailed global environment map.
The researchers implemented several flight phases, including learning flights, outbound navigation, inbound navigation, and final visual homing.
The basic obstacle detection and avoidance logic remained similar across these phases, but the way the drone resumed navigation after an avoidance maneuver was different.
During outbound and inbound navigation, the aircraft generally attempted to realign with its previous navigation target after avoiding an obstacle.
The goal was to continue the original route rather than treat obstacle avoidance as a separate mission.
During final visual homing, things worked differently.
Instead of simply returning to the previous heading, the drone captured a new image from its current position and passed it to the visual homing network to estimate an updated flight direction.
This matters because an avoidance maneuver can change both the drone's position and orientation.
During visual homing, the next movement needs to be determined from what the aircraft currently sees, not necessarily from the direction it was following before the obstacle appeared.
Obstacle detection and autonomous navigation are closely connected, but they solve different problems.
A LiDAR rangefinder can tell the controller that an obstacle is present at a certain distance. It does not determine where the drone ultimately needs to go.
In this architecture, the reactive controller deals with immediate obstacles, while the higher-level navigation algorithm decides how the aircraft should continue toward its destination.

4. Is This a Useful Approach for Small UAV Developers?

For developers working with Pixhawk, PX4, or Raspberry Pi-based autonomous drones, this setup offers a practical example of matching sensor inputs to the actual requirements of a control algorithm.
If an avoidance algorithm doesn't need a complete environment map, it's worth asking what information it really needs.
Consider a small experimental drone flying at relatively low speeds.
If the main requirement is to detect obstacles ahead and make simple left-or-right avoidance decisions, using direct range measurements may be easier to implement than building an entire depth-image processing pipeline.
But the requirements change when the aircraft needs to navigate through narrow openings, detect complex obstacle boundaries, or plan continuous trajectories at higher speeds.
In those situations, a few directional distance measurements may not provide enough information.
The sensor configuration used in the Bee-Nav study is also interesting because the researchers didn't try to make one sensor handle every perception task.
Different components served different purposes:
  • Three Benewake TF-Nova LiDAR rangefinders: Measured obstacle distances in the left, center, and right directions for reactive avoidance.
  • Benewake TFmini-S: Provided altitude measurements to support onboard motion estimation.
  • PMW3901 optical flow sensor: Supplied observations of the drone's movement relative to the ground.
  • IMU and extended Kalman filter (EKF): Combined sensor measurements to estimate the aircraft's motion and state.
  • Omnidirectional camera: Captured visual information for the learned homing system.
The distinction between TFmini-S and TF-Nova is worth making. Both are LiDAR rangefinders, but they served different purposes in this experiment.
The TFmini-S was used for altitude measurement.
Optical flow provides information about apparent ground movement, but converting that image motion into useful horizontal velocity estimates requires knowledge of the drone's distance from the ground.
That's where altitude measurements become important.
The three TF-Nova sensors, meanwhile, were dedicated to detecting obstacles ahead of the aircraft.
Separating these functions makes it easier to understand what each sensor contributes and allows developers to work on individual parts of the perception system.
That doesn't necessarily make the overall hardware integration simpler.
Multiple independent rangefinders still introduce practical considerations such as mounting space, power distribution, communication interfaces, sensing coverage, and data synchronization.
Whether this approach makes sense depends on the aircraft and what it's expected to do.
31306677053?profile=RESIZE_710x

5. Does Drone Obstacle Avoidance Really Need More Sensor Data?

Coming back to the original hardware change, replacing a depth camera with three directional LiDAR sensors doesn't suggest that depth perception is unnecessary.
Nor does it establish that LiDAR is inherently better than a camera-based solution.
The two approaches simply provide different kinds of information.
A depth camera is useful when an application needs a more detailed understanding of the surrounding space, such as analyzing obstacle geometry, identifying traversable regions, or supporting local path planning.
Directional LiDAR measurements are more limited, but also more direct.
If the control algorithm only needs to know whether the forward path is blocked and which side has more clearance, a handful of range measurements may be enough.
That's essentially the approach used in the Bee-Nav experiments.
The researchers didn't build a separate 3D map for obstacle avoidance. Instead, they used directional range measurements to trigger predefined control responses through a finite-state machine.
Visual homing, motion estimation, and obstacle detection were handled by different parts of the system.
For small UAVs, where payload capacity, onboard computing power, and energy consumption are all constrained, this is a useful design choice to examine.
The real question isn't how much environmental data a sensor can produce, but how much of that data the flight controller actually needs.
Of course, more demanding environments may justify wider sensing coverage, depth cameras, 3D LiDAR, or more sophisticated local planning algorithms.
The appropriate sensing architecture ultimately depends on the mission.
What I'd be interested to hear from other UAV developers is where you draw the line between simple range-based obstacle avoidance and more complete spatial perception.
If you're building a small autonomous drone, when would you choose multiple directional LiDAR rangefinders over a depth camera?
And which factor would influence your decision most: flight speed, obstacle density, or available onboard computing power?

Research Reference

Ou, D. et al. Efficient robot navigation inspired by honeybee learning flights. Nature 653, 1039–1046 (2026).

Open-Source Project

Read more…

31082517073?profile=RESIZE_710x

TFmini-Plus can be connected with the IIC port of CUAV V5. There are four IIC ports available on the flight controller, but by default, data can only be read through IIC port-2. In order to use other ports, some settings will be required like compiling the firmware from source code etc., because there is no direct settings available in Ardupilot firmware, but this is not investigated yet. In this tutorial, we will use IIC port-2. LiDAR can be interfaced with flight controller for the purpose of Altitude Holding or Obstacle Avoidance (both will be explained in this document). At the time of writing this document, the controller used was CUAV V5 flashed with ArduCopter V4.0.7, but this document can be used with other flight controllers running with different ArduPilot firmware versions with slight modification in parameter names and choosing the right port on flight controller.

1. TFmini-Plus Settings:

Note: If there are fluctuations in readings, then set the frame rate to 250Hz otherwise don’t need for it. Please see the details of “frame rate” and changing the communication interface in Section-7.4 table-11.

Standard output mode of LiDAR should be used instead of PIX mode in the latest firmwares. PIX mode was only required for the firmware versions older than Arducopter V3.6.2.

The default communication of TFmini-Plus is TTL, IIC and TTL uses the same cable, so set TFmini-Plus to IIC communication first. You can see detail commands in product manual.

We take two TFmini-Plus as an example (for obstacle) avoidance in this tutorial and set the address 0x10 and 0x11 separately.

Note:

  1. Default cable sequence of TFmini-Plus and CUAV V5 is different, please change it accordingly (SDA and SCL wires need to be interchanged) or you can make an intermediate cable for connecting mini-Plus with controller. Controller needs GH 1.25 4-pin connector to interface LiDAR with IIC port-2. Looking at the pinout of controller, pin configurations are starting from left to right:31082519660?profile=RESIZE_710x
  2. IIC connector should be purchased by user
  3. If TFmini-Plus faces down, please ensure the distance between lens and ground is larger than TFmini-Plus’s blind zone (10cm)
  4. If more TFmini-Plus need to be connected (10 LiDARs can be connected), the method is same.
  5. Power source should meet the product manual demands:5V±0.5V, larger than 140mA*number of TFmini-Plus

2. CUAV V5 Connection:

See the connection details in CUAV V5 manual and TFmini-Plus manual:

31082519886?profile=RESIZE_710x

Figure 1: Schematic Diagram of Connecting Two TFmini-Plus to I2C Interface of CUAV

3. Parameters settings (Obstacle Avoidance):

Connect the flight control board to Mission Planar. Select [CONFIG/TUNING] and then click on [Full Parameter List] in the left from the below bar. Find and modify the following parameters:

31082520852?profile=RESIZE_710x

Attention: distance between UAV margin and LiDAR should be larger than LiDAR non-detection zone.

Common settings:

AVOID_ENABLE= 3 [if 3 = UseFence and UseProximitySensor doesn’t work in IIC then choose 2 = UseProximitySensor]

AVOID_MARGIN=4 [can be set based on user requirements]

PRX_TYPE=4

Settings for first TFmini-Plus:

RNGFND1_ADDR=16 [Address of #1 TFmini-Plus in decimal]

RNGFND1_MAX_CM=400 [It could be changed according to real application requirement but should be smaller than effective measure range of LiDAR, unit is cm] 

RNGFND1_MIN_CM=30 [It could be changed according to real application requirement and should be larger than LiDAR non-detection zone, unit is cm] 

RNGFND1_ORIENT=0 [#1 TFmini-Plus real orientation]

RNGFND1_TYPE = 25 [TFmini-Plus IIC same as TFmini-S IIC]

Settings for second TFmini-Plus:

RNGFND2_ADDR=17 [Address of #2 TFmini-Plus in decimal]

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT=1 [#2 TFmini-Plus real orientation]

RNGFND2_TYPE=25 [TFmini-Plus IIC same as TFmini-S IIC]

Upon setting of these parameters, click [Write Params] on the right of mission planner to finish. After writing the parameters you need to power off the controller and then turn it on to apply the setting changes.

31082521460?profile=RESIZE_584x

If the error message “PreArm: check the proximity sensor” appears, please check if the connection is correct, the power supply is normal and youhave restarted the controller. Also check whether you have changed the mode from Standard mode to Pix mode while the firmware is 3.6.2 or higher. If yes, then the same error will encounter.

How to see the target distance from the LiDAR: press Ctrl+F button in keyboard, the following window will pop out:

31082521877?profile=RESIZE_710x

Click button Proximity, the following window will appear:

31082522070?profile=RESIZE_710x

The number in green color means the distance from LiDAR in obstacle avoidance mode(it doesn’t mean the real time distance from LiDAR) and will not be influenced in Mission Planner. The mission planner version at the time of writing this tutorial was v1.3.69.

4. Parameters settings (Altitude Hold):

Connect the flight control board to Mission Planar. Select [CONFIG/TUNING] and then click on [Full Parameter List] in the left from the below bar. Find and modify the following parameters:

31082522285?profile=RESIZE_710x

Note: If RNGFND1 and RNGFND2 are already configured, then use RNGFND3 or other as Altitude Hold Sensor.

RNGFND3_ADDR=18

RNGFND3_TYPE = 25 [TFmini-Plus IIC option]

RNGFND3_MIN_CM = 30 [It could be changed according to real application requirement and should be greater LiDAR than non-detection zone, unit is cm]

RNGFND3_MAX_CM = 300   [It could be changed according to real demands but should be smaller than effective measure range of LiDAR, unit is cm]

RNGFND3_GNDCLEAR = 15 [expressed in cm, depending upon mounting height of the module and should be greater LiDAR than non-detection zone]

RNGFND3_ORIENT=25 [facing down]

Upon setting of these parameters, click [Write Params] on the right of mission planner to finish. After writing the parameters, you need to power off the controller and then turn it on to apply the setting changes.

If the error message “Bad LiDAR Health” appears, please check if the connection is correct, the power supply is normal and you have restarted the controller. Also check whether you have changed the mode from Standard mode to Pix mode while the firmware is 3.6.2 or higher. If yes, then the same error will encounter.

How to see the altitude value from LiDAR sensor: double click the area of the Mission Planner, look at the following picture:

31082522864?profile=RESIZE_710x

Select option sonarrange, see following picture:

31082522896?profile=RESIZE_710x

The altitude distance from the LiDAR will be displayed in Sonar Range (meters), see the following picture:

31082523056?profile=RESIZE_710x

For more information about TFmini-Plus, see https://benewake.short.gy/tfminis-lidar-diy.

Read more…

Application of TFmini-S in PixHawk

TFmini-S can directly be connected with the serial port of PixHawk. TFmini-S can be used in flight controller for the purpose of altitude holding or obstacle avoidance. This document is suitable to PixHawk adopts ArduCopter V3.6.2 or higher firmware (Note: Standard output mode should be used instead of PIX mode by Benewake GUI in firmware V3.6.2 or above).

Example for connecting PixHawk:

12699363892?profile=RESIZE_710x

12699363892?profile=RESIZE_710x

Figure 1 Schematic Diagram of Connecting TFmini-S with TELEM 2 Interface (Serial Port 2) of PixHawk

a) Mission Planner configuration description of TFmini-S for the purpose of altitude hold 

Connect the flight control board to Mission Planar. Attention: the installation height should be larger than non-detection zone. Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING]. Find and modify the following parameters:

SERIAL2_PROTOCOL = 9  [Rangefinder option]

SERIAL2_BAUD = 115  [Choose the current LiDAR baud rate, if haven’t been changed, the default baud rate 115200 should be selected, that is 115]

RNGFND1_TYPE = 20 [TFmini-S UART option]

RNGFND1_MIN_CM = 30 [It could be changed according to real demands and should be bigger LiDAR than non-detection zone, unit is cm]

RNGFND1_MAX_CM = 300   [It could be changed according to real demands but should be smaller than effective measure range of LiDAR, unit is cm]

RNGFND1_GNDCLEAR = 15 [expressed in cm, depending upon mounting height of the module and should be bigger LiDAR than non-detection zone]

RNGFND1_ORIENT=25 [face down]

PRX_TYPE=0

Upon setting of these parameters, click [Write Params] on the right of the software to finish.

If the error message “Bad LiDAR Health” appears, please check if the connection is correct and the power supply is normal. Also check it whether you have changed the mode from Standard mode to Pix mode while the firmware is 3.6.2 or higher if yes then the same error will encounter.

How to see the altitude value from LiDAR sensor: double click the area of the Mission Planner, look at the following picture:

12699364865?profile=RESIZE_710x

Select option sonarrange, see following picture:

12699364889?profile=RESIZE_710x

The altitude distance from the LiDAR will be displayed in Sonar Range (meters), see the following picture:

12699365661?profile=RESIZE_710x

B)Mission Planner configuration description of TFmini-S for the purpose of Obstacle Avoidance

It’s only recommended to be used in Loiter mode, the detailed setting is as follows:

Connect the flight control board to MP. Attention: distance between UAV margin and LiDAR should be larger than LiDAR non-detection zone. Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING]. Find and modify the following parameters:

AVOID_MARGIN=2 [Unit: m, set obstacle avoidance distance as required]

SERIAL2_PROTOCOL = 9 [Rangefinder option]

SERIAL2_BAUD = 115 [Choose the current LiDAR baud rate, if haven’t been changed, the default baud rate 115200 should be selected, that is 115]

RNGFND1_TYPE = 20 [TFmini-S UART option]

RNGFND1_MIN_CM = 30   [It could be changed according to real demands and should be bigger LiDAR than non-detection zone, unit is cm]

RNGFND1_MAX_CM = 300 [It could be changed according to real demands but should be smaller than effective measure range of LiDAR, unit is cm]

RNGFND1_GNDCLEAR = 15 [Unit: cm, depending upon mounting height of the module and should be bigger LiDAR than non-detection zone]

RNGFND1_ORIENT=0   [It depends on the LiDAR’s real installation direction, 0~7, 24=Up and 25=Down (total ten) are supported up to now, see detail in MP]

PRX_TYPE=4    [Rangefinder should be selected for proximity sensor in obstacle avoidance mode]

Upon setting of these parameters, click [Write Params] on the right of the software to finish.

If the error message “Bad LiDAR Health” appears, please check if the connection is correct and the power supply is normal.

How to see the target distance from the LiDAR: (distance from LiDAR in obstacle avoidance can’t be displayed in sonarrange option) press Ctrl+F button in keyboard, the following window will pop out:

12699365669?profile=RESIZE_710x

Click button Proximity, the following window will appear:

12699365296?profile=RESIZE_710x

The number in green color means the distance from LiDAR in obstacle avoidance mode(the number only refresh when this window opens, closes, zooms in or zooms out, it doesn’t mean the real time distance from LiDAR and will not be influenced in Mission Planner version under v1.3.48, the problem could be solved by updating Mission Planner)

²  Attach: If TELEM 2 port has been used, SERIAL4/5 interface could be used, the other setting are same

12699365887?profile=RESIZE_710x

Figure 2: Schematic Diagram of Connecting TFmini-S with SERIAL4/5 Interface (Serial Port 4/5) of PixHawk

 

 

Configuration Descriptions of Mission Planner:

Connect flight control board to MP, Select [Full Parameter List] in the left from the below bar [CONFIG/TUNING]. Find and modify following parameters:

SERIAL4_PROTOCOL = 9 (LiDAR)

SERIAL4_BAUD = 115

Upon setting of these parameters, the other parameters should be same as Mission Planner configuration description of TFmini-S for the purpose of Obstacle Avoidance or Altitude Holding, then click [Write Params] on the right of the software to finish.

Read more…

TFmini-S can be used with PixHawk for the purpose of obstacle avoidance.

  1. TFmini-SSettings:

Note: Frame rate should be set to 250Hz, see the details in chapter 7.4 “frame rate” and changing the communication interface.

The default communication of TFmini-S is TTL, IIC and TTL uses the same cable, so please set TFmini-S to IIC communication first, see detail commands in product manual.

We take two TFmini-S as an example in this passage and set the address 0x10 and 0x11 separately.

  1. PixHawk Connection:

See the connection details in PixHawk manual and TFmini-S manual, we take example for connecting

PixHawk flight controller:

12629947677?profile=RESIZE_710x

Figure 1: Schematic Diagram of Connecting TFmini-S to I2C Interface of PixHawk

Note:

  1. Default cable sequence of TFmini-S and PixHawk are different, please change it accordingly (SDA and SCL wires need to be interchanged). Look at the pinout of controller, pin configurations are starting from left to right:

 10961543091?profile=RESIZE_710x

  1. IIC connector should be purchased by user
  2. If TFmini-S faces down, please take care the distance between lens and ground should be larger than TFmini-S’s blind zone (10cm)
  3. If more TFmini-S need to be connected (10 LiDARs can be connected), the method is same.
  4. Power source should meet the product manual demands:5V±0.5V, larger than 140mA*number of TFmini-S
  5. Parameters settings:

Common settings:

AVOID_ENABLE= 2 [if 3 = UseFence and UseProximitySensor doesn’t work in IIC then choose 2 = UseProximitySensor]

AVOID_MARGIN=4

PRX_TYPE=4

Settings for first TFmini-S:

RNGFND1_ADDR=16 [Address of #1 TFmini-S in decimal]

RNGFND1_GNDCLEAR=15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone]

RNGFND1_MAX_CM=400 [It could be changed according to real demands but should be smaller than
effective measure range of LiDAR, unit is cm] 

RNGFND1_MIN_CM=30 [It could be changed according to real demands and should be larger than
LiDAR non-detection zone, unit is cm] 

RNGFND1_ORIENT=0 [#1 TFmini-S real orientation]

RNGFND1_TYPE = 25 [TFmini-S IIC same as TFmini-Plus IIC]

 

Settings for second TFmini-S:

RNGFND2_ADDR=17 [Address of #2 TFmini-S in decimal]

RNGFND2_GNDCLEAR=15

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT=25 [#2 TFmini-S real orientation]

RNGFND2_TYPE=25 [TFmini-S IIC same as TFmini-Plus IIC]

Upon setting of these parameters, click [Write Params] on the right of the software to finish.

If the error message “Bad LiDAR Health” appears, please check if the connection is correct and the power supply is normal.

How to see the target distance from the LiDAR: press Ctrl+F button in keyboard, the following window will pop out:

10961543271?profile=RESIZE_710x

  

Click button Proximity, the following window will appear:

 10961543487?profile=RESIZE_710x

The number in green color means the distance from LiDAR in obstacle avoidance mode(the number only refresh when this window opens, closes, zooms in or zooms out, it doesn’t mean the real time distance from LiDAR and will not be influenced in Mission Planner version under v1.3.48, the problem could be solved by updating Mission Planner

Read more…