Object avoidance with Navio 2

it’s easier if you stick to your thread;

if you wanto to detect obstacles in your way you can use an ultrasound sensor (e.g. maxbotix’s ones) and laser for greater and more precise distances;
AFAIK obstacle avoidance is not (yet) supported in APM but efforts are being made (LightWare SF40/C 360 Lidar — Copter documentation)