Obstruction avoidance test 2 – PASSED!!!!!

After a minor tweak to the handling resolution of the Scanse Sweep data, all works brilliantly.

This is a five metre forwards flight, with the flight paused and later resumed once the obstacle has been avoided.  Note that ‘H’ tracks the obstruction at about one meter away.  Hence she flies a quarter circle around the circular cardboard tube, before continuing the forward flight when the obstruction is behind her.

The code is updated on GitHub as a result.

OA test 1 analysis

My fault: when an obstacle is detected, the autopilot tells ‘H’ to move 90°, parallel to the obstacle, until she reaches the safe zone.  That’s not what the logs from the autopilot say:

AP: PHASE CHANGE: RTF
AP: PHASE CHANGE: TAKEOFF
AP: PHASE CHANGE: HOVER
AP: FILE FLIGHT PLAN
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 6 DEGREES.
AP: PHASE CHANGE: AVOID @ 103 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 7 DEGREES.
AP: PHASE CHANGE: AVOID @ 94 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 13 DEGREES.
AP: PHASE CHANGE: AVOID @ 81 DEGREES
AP: AVOIDING OBSTACLE @ 11 DEGREES.
AP: PHASE CHANGE: AVOID @ 79 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 15 DEGREES.
AP: PHASE CHANGE: AVOID @ 76 DEGREES
AP: AVOIDING OBSTACLE @ 15 DEGREES.
AP: PHASE CHANGE: AVOID @ 72 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 14 DEGREES.
AP: PHASE CHANGE: AVOID @ 70 DEGREES
AP: AVOIDING OBSTACLE @ 18 DEGREES.
AP: PHASE CHANGE: AVOID @ 72 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 23 DEGREES.
AP: PHASE CHANGE: AVOID @ 72 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 31 DEGREES.
AP: PHASE CHANGE: AVOID @ 73 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 31 DEGREES.
AP: PHASE CHANGE: AVOID @ 65 DEGREES
AP: AVOIDING OBSTACLE @ 37 DEGREES.
AP: PHASE CHANGE: AVOID @ 59 DEGREES
AP: OBSTACLE AVOIDED, RESUME PAUSED
AP: PHASE CHANGE: FORE
AP: AVOIDING OBSTACLE @ 40 DEGREES.
AP: PHASE CHANGE: AVOID @ 71 DEGREES
AP: PROXIMITY LANDING 1.46 METERS
AP: PHASE CHANGE: PROXIMITY CRITICAL 0.67m
AP: LANDING COMPLETE
AP: FINISHED

Frankly, it’s a miracle the video looked as good as it did! Clearly, there’s something wrong with compensating direction angles, as the OBSTACLE and AVOID angles should be ±90°.  Superficially this should be simple to fix, fingers crossed.


P.S. Based on the video, Sweep angles are correct; it’s my code calculation that’s wrong; for example, the final sample of the object at +40°should result of a result of -50° not 71°.

P.P.S.  The bug was crass; the log used the distance not direction, and the functional code is correct.  I suspect the problem’s solution is fine-tuning of the critical vs. warning ranges.