Autonomous flight with obstacle avoidance

I am working on a drone that will mode autonomously to specific waypoints and at the same time if it detects an obstacle it has to turn left or right to avoid it and continue its mission. I want to send the mavlink command to the pixhawk to turn left or right when the sensor gives value… I need help regarding the approach to be taken in this…Will the commands sent by the raspberry pi be able to override the autonomous mode for some time and then continue working in autonomous mode???

Yes, this is possible, but this is everything I know about this approach…

Considering the obstacle avoidance feature (and everything else), update to the latest stable feature, it had several improvements since 4.0 version.

Maybe @rmackay9 and @amilcarlucas can give you some advice about this use profile.

Yes, you can use the RPi with pymavlink or mavros to:

  1. read the obstacle avoidance via mavlink,
  2. switch the flight mode to guided when an obstacle is close.
  3. use guided commands to move the copter away from the obstacle
  4. switch flight mode to auto once the obstacle is far enough

Thanks for helping @amilcarlucas!

Techically you can implement the bendy ruler controller:

And send a Proximity type message through Mavlink: