Obstacle Avoidance (The Real Commit)

My old code was deleted, so this is new code, still needs testing from
my side.  However, nothing more than threshold numbers need to be
changed.