MAVLINKHUD

Overview

The OA parameter group configures the Object Avoidance path-planning engine. This subsystem uses distance data from Proximity sensors (Lidar/Sonar) or Visual Odometry to autonomously steer the vehicle away from obstacles in real-time.

Unlike simple "BendyRuler" avoidance, the OA library can manage complex 3D environments and find optimal paths around large structures.

Key Concepts

1. Avoidance Types (OA_TYPE)

Selects the primary path-finding algorithm.

  • 0: Disabled.
  • 1 (BendyRuler): Simple and fast. Tries a few "rays" to see which path is clear and chooses the one closest to the target waypoint.
  • 2 (Dijkstra): Uses a pre-mapped database of the environment (OA_DB_...) to calculate the mathematically shortest path around an obstacle.
  • 3 (SimpleGCS): Offloads calculation to a Ground Station.

2. Database Management (OA_DB_...)

If using Dijkstra, the drone builds a "Database" of known obstacles.

  • OA_DB_SIZE: The number of points held in the map.
  • OA_DB_EXPIRE: How long a point stays in the map after it is no longer visible.

3. Lookahead (OA_BR_LOOKAHEAD)

Defines how far ahead of the vehicle the algorithm should search for obstacles.

Parameter Breakdown

  • OA_TYPE: Algorithm selector.
  • OA_MARGIN_MAX: The minimum distance the vehicle will attempt to maintain from any obstacle.
  • OA_OPTIONS: Bitmask for specialized behaviors.

Integration Guide

  1. Sensors: Requires a 360-degree Lidar (e.g., RPLidar) or multiple directional proximity sensors.
  2. Enable: Set OA_TYPE = 1 (BendyRuler) for general outdoor use.
  3. Margin: Set OA_MARGIN_MAX = 2.0 (meters) to ensure a safe buffer.

Developer Notes

  • Library: libraries/AC_Avoidance.
  • Path Planning: The OA engine calculates a "Virtual Waypoint" which is then fed to the L1 or Position Controller.

OA_BR_CONT_ANGLE

deg
Default 75
Range 0 180

BendyRuler Continuity Angle (OA_BR_CONT_ANGLE)

Description

OA_BR_CONT_ANGLE defines a "Trust Zone" for small maneuvers.

If the path planner suggests a turn smaller than this angle, the drone will take it immediately. If the suggested turn is larger than this angle (e.g. a sharp 90-degree turn), the drone will only commit if the new path is significantly clearer (as defined by OA_BR_CONT_RATIO). This keeps the drone's flight paths smooth and predictable.

OA_BR_CONT_RATIO

Default 1.5
Range 1.0 5.0

BendyRuler Continuity Ratio (OA_BR_CONT_RATIO)

Description

OA_BR_CONT_RATIO prevents the drone from "Indecisive" maneuvering.

When the BendyRuler algorithm finds an alternative path around an obstacle, it compares the "Clearance" (margin) of the new path to the current one. This parameter defines the required improvement. If set to 1.5, the new path must have 50% more clearance than the current path before the drone will turn toward it. This prevents the drone from constantly twitching back and forth between two similar-looking gaps.

OA_BR_LOOKAHEAD

m
Default 5.0
Range 1 20

BendyRuler Lookahead (OA_BR_LOOKAHEAD)

Description

OA_BR_LOOKAHEAD defines the "Vision Range" of the reactive path planner.

BendyRuler peeks ahead of the drone to see if the current path is blocked. If it sees an obstacle within this distance, it starts checking alternative "Probes" (slightly left, slightly right) to see if there's a clear gap.

  • Higher Value: Earlier reactions to obstacles. Better for high-speed flight.
  • Lower Value: Later reactions. Allows the drone to get closer to objects before maneuvering.

OA_BR_TYPE

Default 1
Range 0 2

BendyRuler Type (OA_BR_TYPE)

Description

OA_BR_TYPE restricts which way the drone can dodge.

  • 1: Horizontal (Default). The drone steers left or right to go around the obstacle. Standard behavior.
  • 2: Vertical. The drone climbs over or dives under the obstacle. (Risky if you don't have good ceiling/floor sensors).

Tuning & Behavior

  • Default Value: 1.
  • Recommendation: Stick to 1 (Horizontal) for most multirotors unless you are flying in a narrow canyon where going up is the only option.

OA_DB_ALT_MIN

m
Default 0
Range 0 5

OADatabase Min Altitude (OA_DB_ALT_MIN)

Description

OA_DB_ALT_MIN prevents the drone from trying to "Avoid" the ground or grass during takeoff and landing.

If set to 1.0, the drone will ignore all sensor detections until it is more than 1 meter high. This prevents false detections from long grass or uneven terrain from triggering a panicked maneuver while the drone is still close to its launch point.

OA_DB_BEAM_WIDTH

deg
Default 5.0
Range 1 10

OADatabase Beam Width (OA_DB_BEAM_WIDTH)

Description

OA_DB_BEAM_WIDTH helps the drone estimate how "Wide" a detected object is.

Most Lidars have a divergent beam. If the sensor detects something 10 meters away, ArduPilot uses this angle to calculate the minimum radius of the obstacle. This ensures the path planner doesn't try to fly through a gap that is too small for the drone's actual size.

OA_DB_DIST_MAX

m
Default 0
Range 0 100

OADatabase Max Distance (OA_DB_DIST_MAX)

Description

OA_DB_DIST_MAX sets the "Horizon" for obstacle avoidance.

Detection sensors often have long ranges, but their accuracy decreases with distance. By setting a max distance (e.g. 10m), you ensure that the autopilot only maneuvers for obstacles that are close enough to be accurately positioned and pose a real threat.

  • 0 (Default): No limit. All detected points are added to the database.

OA_DB_EXPIRE

s
Default 10
Range 0 127

OADatabase Item Timeout (OA_DB_EXPIRE)

Description

OA_DB_EXPIRE controls the "Forgetting Speed" of the drone.

In a dynamic environment (like people walking around), you want the drone to forget old obstacle locations quickly. In a static environment (like a building site), you want it to remember them longer.

  • 0: Never forget. Useful for pre-loaded static maps.
  • 10 (Default): Standard for mixed environments.

OA_DB_OUTPUT

Default 1
Range 0 3

OADatabase Output Level (OA_DB_OUTPUT)

Description

OA_DB_OUTPUT determines what you see on your Mission Planner or QGC screen.

The drone always uses all known obstacles for its own avoidance, but sending every single point to the Ground Station can overwhelm the telemetry radio.

  • 0: Disabled. No obstacles are shown on the map.
  • 1: High Importance (Default). Only show obstacles that are very close.
  • 3: All. Show every detected point.

OA_DB_QUEUE_SIZE

Default 80
Range 1 200

OADatabase Queue Size (OA_DB_QUEUE_SIZE)

Description

OA_DB_QUEUE_SIZE defines the size of the "Inbox" for sensor data.

Proximity sensors (like Lidars) send huge amounts of data. This queue holds the raw points until the flight controller has enough spare CPU time to process them into the obstacle database.

  • Higher Value: Can handle larger bursts of data without losing points. Good for high-resolution Lidars.
  • Lower Value: Saves RAM on small flight controllers.

OA_DB_RADIUS_MIN

m
Default 0.01
Range 0 10

OADatabase Minimum Radius (OA_DB_RADIUS_MIN)

Description

OA_DB_RADIUS_MIN ensures that every detected point is treated as a solid object with at least some physical dimension. Even if the Lidar beam is perfectly narrow, ArduPilot will assume the obstacle has at least this much radius to provide a safety margin for the drone's frame.

OA_DB_SIZE

Default 100
Range 0 10000

OADatabase Max Points (OA_DB_SIZE)

Description

OA_DB_SIZE sets the memory limit for the "Obstacle Memory."

When a drone uses a Lidar or Depth Camera, it sees thousands of points. The database filters these into a smaller list of distinct obstacles. This parameter determines how many of those obstacles the drone can remember at once.

  • Higher Value: Better for complex environments (like dense forests), but uses more CPU and RAM.
  • Lower Value: Safer for drones with limited processing power.

Tuning & Behavior

  • Default Value: 100.
  • Reboot Required: Yes.

OA_MARGIN_MAX

m
Default 2.0
Range 0.1 10.0

Object Avoidance Margin (OA_MARGIN_MAX)

Description

OA_MARGIN_MAX defines the "Safety Buffer" around obstacles.

When the path planner calculates a route around a tree or building, it will ensure that the drone never comes closer than this many meters to the object.

  • Higher Value: Safer, but the drone might refuse to fly through narrow gaps (like a doorway).
  • Lower Value: The drone will fly much closer to objects, allowing for tighter maneuvers.

Tuning & Behavior

  • Default Value: 2.0m.
  • Recommendation: Set this to at least 2 times the radius of your drone (including propellers) for safety.

OA_OPTIONS

Default 0
Range 0 7

Object Avoidance Options (OA_OPTIONS)

Description

OA_OPTIONS provides specialized toggles for the path planning system.

  • Bit 0 (1): Enable Logging. (Useful for developers to see why a drone chose a specific path).
  • Bit 1 (2): Use Proximity.
  • Bit 2 (4): Use Fence.

OA_TYPE

Default 0
Range 0 4

Object Avoidance Type (OA_TYPE)

Description

OA_TYPE activates the "Path Planner," which allows the drone to find its way around obstacles.

While standard avoidance (AVOID_ENABLE) just stops the drone, the Object Avoidance (OA) system tries to calculate a new route around the obstacle to reach the target.

  • 0: Disabled.
  • 1: BendyRuler. A fast, reactive algorithm that "Peeks" left and right to find a gap. (Best for trees and pillars).
  • 2: Dijkstra. A global planner that uses a pre-mapped "Fence" or "Database" of obstacles to find the shortest clear path. (Best for complex static environments).

Tuning & Behavior

  • Default Value: 0.
  • Requirements: Requires a functional proximity sensor (Lidar, Depth Camera) or a pre-loaded obstacle database.
  • Reboot Required: Yes.