Simple Object Avoidance

Copter supports simple object avoidance horizontally and upward, while Rover avoids simple objects by only stopping. Both use proximity sensors such as:

In addition, Simple Object Avoidance can use Geo-Fences and Fence Beacons as proximity sensors as determined by the setting of the AVOID_ENABLE parameter.

Simple Object Avoidance Algorithms

Horizontal object avoidance works in AltHold and Loiter modes. Upward object avoidance works in LOITER, ALTHOLD modes only.

Warning

Only one proximity sensor source can be enabled, using either a 360 degree lidar or up to 9 rangefinders.

Note

For Object Avoidance in AUTO and GUIDED modes in Copter and Rover, see Object Avoidance with Bendy Ruler or Object Avoidance with Dijkstra’s

Details on how simple object avoidance is implemented for Copter in ALTHOLD and LOITER mode can be found here in the developer wiki and involves assessing all the objects detected, in all reported quadrants, and adds control input to the pilot’s,trying to move away from the aggregate threat or stop.

In ALTHOLD mode, the aggregate threat is translated into an attempt to add lean input into the pilot’s commands to move the Copter away from the aggregate obstructions. The pilot can still overcome these additions to his command inputs and fly into a object, if determined to do so.

In LOITER, either stopping in front of the object or a “sliding” algorithm is used to avoid it. “Sliding” involves slowing and slightly yawing as the vehicle approaches the object. For example, if Copter approaches a fence line at an angle, it will “slide along” the fence as the operator pushes the Copter toward the fence. Head-on approaches would stop, even if the pilot continues to “pushes” it forward.

Setup the Proximity Sensor

For lidars follow the instructions corresponding to the lidar on the vehicle on the Proximity Sensor documentation.

For other rangefinders follow the instructions found in there individual setup pages here

Be sure to read the RangeFinders Setup Overview page

SAFETY FIRST!

  • The avoidance algorithms have been constantly changing. While in most scenarios it will help the user keep the vehicle safe from any obstacles, or fence breaches; due to unknown sensor glitch, or other such problems, avoidance should be swiftly turned off mid-flight (especially while trying for the first time).
  • Set any vacant channel of your Transmitter to use RCx_OPTIONS parameter and set it to 40. For example, if channel 8 switch of your transmitter is vacant, set RC8_OPTION = 40.
  • Toggling this switch to HIGH would switch on Proximity based avoidance and vice versa.

Configuring Simple Avoidance for Copter in Loiter Mode

  • set AVOID_ENABLE = 7 (“All”) to use all sources of barrier information including “Proximity” sensors
  • set PRX_TYPE to a 360 deg Lidar type being used or = 4, to enable using range finders as “proximity sensors”
  • in Loiter
    • AVOID_MARGIN controls how many meters from the barrier the vehicle will attempt to stop or try to slide along it
    • AVOID_BEHAVE allows setting whether the vehicle should simply Stop in front of the barrier or Slide around it. This parameter only affects Copter, since Rover always stops.

Configuring Simple Avoidance for Rover

  • set AVOID_ENABLE = 7 (“All”) to use all sources of barrier information including “Proximity” sensors.
  • set PRX_TYPE = “4” to enable using range finders as “proximity sensors”
  • Rover attempts to stop the vehicle before it hits objects in all modes except MANUAL.

“Stop” Avoidance

Advanced Configuration for Simple Avoidance (Copter/Rover 4.1 and above)

Backing away from obstacles

The vehicle will actively attempt to maintain distance (margin) from obstacles. This means that if an obstacle approaches the vehicle from any direction, and the sensor detects it, the vehicle will back away from the obstacle.

  • The speed of this backing away can be controlled via the parameter: AVOID_BACKUP_SPD
  • Setting this parameter to zero would disable backing up. Therefore, the vehicle will attempt to stop or slide in front of the obstacle, but never try and maintain a margin from the obstacle if it was to come closer due to any reason.

Getting smoother avoidance experience

  • Depending on the tuning of the vehicle, current velocity, distance to the obstacle; the user might feel that while avoidance is active, the vehicle response is very “jerky” and not smooth.
  • In this case, user should reduce the maximum acceleration with which the vehicle would avoid obstacles. See the parameter AVOID_ACCEL_MAX.

Warning

Setting AVOID_ACCEL_MAX too low would mean that the response to the obstacle will be very sluggish and the vehicle may not be able to stop in time. Therefore, be careful while pushing this parameter to extremes.

Minimum altitude (Copter only)

  • If the sensor has a wide field of view, on takeoff and landings it might see the ground below as obstacle and the vehicle might react to it.
  • Set the parameter AVOID_ALT_MIN to have a minimum altitude before avoidance is switched on.

Note

This feature requires a valid Downward Facing Rangefinder reading to works

Configuring Simple Avoidance for Copter in Altitude Hold Mode

Warning

While this mode does have the option of avoidance, avoidance in Loiter mode is much more advanced and has more features.

  • in AltHold
    • AVOID_DIST_MAX controls how far from a barrier the vehicle starts leaning away from the barrier
    • AVOID_ANGLE_MAX controls how far the vehicle will try to lean away from the barrier