Integrating Obstacle Avoidance with Livox LiDAR & 4 ultrasonic obstacle/distance sensors on PX4

Hi everyone,

I’m running SLAM on my drone using a Livox LiDAR for positioning. I now want to integrate real-time obstacle avoidance using the same sensor data and i also have 4 ultrasonic sensors at each direction Specifically, I’d like to:

  • Create a local mapping module (e.g., a costmap) that processes live LiDAR data or ultrasonic sensors data to detect obstacles.
  • Integrate a local planner (like DWA) to generate safe commands that work alongside the global SLAM output.
  • Interface these commands with PX4 for dynamic obstacle avoidance.

I’m looking for guidance on setting up the local costmap, integrating ROS navigation packages (costmap_2d, move_base), and tips on testing and tuning the system on a drone. I have implemented a ‘crude/hardcoded’ obstacle avoidance system which detects the obstacle and moves in direction to avoid it but it only uses ultrasonic sensor… and it works well for only one direction only.If I try to implement that same thing in other directions… it gets messy. So, I am looking at other options to implement this kind of avoidance system. Any example configurations or best practices would be greatly appreciated!

Thanks in advance.