RangeFinders (Sonar/Lidar) for Object Avoidance

RangeFinders (Sonar or Lidar) can be used for Object Avoidance in Copter-3.5 (and higher) in Loiter and AltHold modes.


This feature is new for Copter-3.5 and should be used with caution. Only up to two rangefinders can be used at the same time although a minor code change can allow up to 4 to be used.

Connecting and Configuring the Lidar

  • follow the normal instructions for setting up rangefinders.
  • set the RNGFNDx_ORIENT parameters (i.e. RNGFND_ORIENT, RNGFND2_ORIENT) to specify the direction the range finder is pointing in (i.e. 0=Forward, 2=Right, 4=Back, 6=Left, 24=Up, 25=Down)
  • set PRX_TYPE = “4” to enable using range finders as “proximity sensors”.
  • set AVOID_ENABLE to “7” to enable avoidance using proximity sensors (and fences)