Object Avoidance

Copter 3.5 (and higher) supports object avoidance horizontally and upwards using:

Horizontal object avoidance works in AltHold and Loiter modes. Upward object avoidance works in all modes except Stabilize and Acro.

Details on how object avoidance is implemented can be found here in the developer wiki

Setup the Lidar

For 360 lidar follow the instructions corresponding to the lidar on the vehicle

For other lidar follow the instructions found here

Configuring Avoidance

  • set AVOID_ENABLE = 7 (“All”) to use all sources of barrier information including “Proximity” sensors
  • in Loiter
    • AVOID_MARGIN controls how many meters from the barrier the vehicle will attemp to stop
    • AVOID_BEHAVE allows setting whether the vehicle should simply Stop in front of the barrier or Slide around it
  • in AltHold
    • AVOID_DIST_MAX controls how far from a barrier the vehicle start leaning away from the barrier
    • AVOID_ANGLE_MAX controls how far back the vehicle will lean away from the barrier

Real-time view

Real-time distances can be seen in the Mission Planner’s proximity viewer


This window can be opened by moving to the MP’s Flight Data screen, press Ctrl-F and push the Proximity button.


DataFlash logging

Upward and downward facing range finder distances can be seen in the DataFlash Log’s RFND message.

The distance to the nearest object in 8 quadrants around the vehicle is recorded in the DataFlash log’s PRX messages.


Copter’s object avoidance feature has the following limitations. Future versions will likely resolve these.

  • Object avoidance only works in Loiter and AltHold modes
  • The vehicle should stop before hitting objects but will never back away from objects that approach the vehicle (a slow backing away will be added in future firmware versions)
  • Avoidance is “sensor based” meaning it is not building up a 3D map and thus has no “memory” of where barriers were once they are out of view of the lidar