I am trying to perform obstacle avoidance with my drone, I have a proximity sensor configured and connected to it but when I take it towards the obstacles, it doesn’t react at all.
I’ve tried flying in AltHold, PosHold, and Stabilizes modes but it doesn’t in either of these modes.
If you’re not seeing the ping-pong behaviour then the issue could be in data being provided to the proximity sensor library (maybe it’s timing out?). We’d need to see an onboard log to investigate further.
By the way, this ping-pong behaviour is the best we can do in AltHold because this mode does not rely on the GPS (or more accurately the EKF’s estimated velocity of the vehicle). This is why we recommend using Loiter instead.
As a bit of an editorial, we added this ping-pong version of object avoidance mostly to save developers from wasting their time re-inventing this feature only to discover that it doesn’t actually work very well. We saw at least three different implementations.
The OA_TYPE parameter is for enabling BendyRuler or Dijkastras (aka AStar) path planning around obstacles. This is really for auto mode (not Loiter or AltHold).
Simple avoidance doesn’t work in PosHold because the pilot controls the vehicle’s lean angles (just like AltHold). The velocity of the vehicle is only controlled during the slowdown.
In general we recommend users use Loiter instead of PosHold where possible.
Auto and Guide modes implement path planning (e.g. BendyRuler and Dijkstras/AStar) to fly around obstacles instead of stopping. There is an enhancement underway to also implement simple avoidance in Auto and Guided but only using Proximity sensors and it hasn’t completed the peer review yet. I expect this will be included in 4.6.0.
The problem with object avoidance is normally not in the algorithms (e.g. Bendy Ruler) it is the quality of the lidar data provided to them. You should actually see little red circles on the MP map highlighting where AP thinks there are obstacle.
Sorry for not including that parameter change requirement on the wiki. I’ve created a wiki PR to update this so it should be easier for the next person who hits this issue.
Simple Avoidance Works in robustly in Loiter mode, In AltHold mode it’ll work but can be overridden by Pilot.
Bendy Ruler and Dijkstra’s Works robustly in Auto and Guided Modes. GUID_OPTIONS needs to be set to 6th bit or “Waypoint navigation used for position targets”