Fast 3D obstacles avoidance

The goal of this project is to create a fast and simple 3D local planner for obstacle avoidance. This planner accepts a target direction and a stereo disparity image, then generates a safe direction. It implements parts of Baumann, Tanja, “Obstacle Avoidance for Drones Using a 3DVFH* Algorithm”, with some modifications. GitHub - chobitsfan/3dvfh

The hardware setup includes a Raspberry Pi 5 as the companion computer and a Luxonis OAK-D Lite stereo camera. In the following tests, the drone attempts to reach a target located 30 meters ahead of the starting point at a speed of 5 m/s. In the video, the quadcopter attempts to avoid obstacles while flying toward the target.

The planner continuously generates a safe navigation direction that is as close as possible to the target direction, and sends it to the flight controller as the SET_POSITION_TARGET_LOCAL_NED MAVLink message. In the video, the short arrow indicates the target direction, while the long arrow represents the safe direction generated by the 3DVFH algorithm.

A slightly modified ArduPilot branch that supports the MAV_FRAME_BODY_FRD coordinate frame in the SET_POSITION_TARGET_LOCAL_NED message is used in this project. Because the stereo camera is fixed to the drone body, the safe direction returned by the 3DVFH algorithm is expressed in the body-fixed frame. Currently, ArduPilot treats the forward axis of MAV_FRAME_BODY_OFFSET_NED and MAV_FRAME_BODY_NED as aligned with the front of the vehicle in the horizontal plane. At higher speeds, a quadcopter tilts more significantly, making these differences non-negligible. While it is possible to request ArduPilot to send the current attitude and perform the coordinate system translation on the companion computer, this approach requires the current attitude to be sent at a high frequency.

Some parts of this project were contributed by Ludovic Angot. Additional components were developed with assistance from AI-based coding tools, including ChatGPT, Gemini, Copilot, and Claude.

3 Likes

Nice work @chobitsfan ! What update rate are you achieving in practice?

1 Like

The stereo camera operates at 20 fps, and each time the obstacle avoidance algorithm receives a stereo image, it generates a new safe direction.

1 Like

So effectively <=20hz. Cool.
Will be interesting to see how this behaves with a global planner in a cluttered environment at high speeds : )

1 Like

I make a simple flying test with obstacle avoidance at 2m/s in the woods

3 Likes

vibe coding.

1 Like