Obstacle Avoidance on ROS2

Hello, I wish to build a drone to perform flight in mission mode with obstacle avoidance with a companion computer running ROS2 Humble, so the operating system is Ubuntu 22.
I have check the github page for PX4_Avoidancehttps://github.com/PX4/PX4-Avoidance but I have read on some post like this:https://github.com/PX4/PX4-Avoidance/pull/626#issuecomment-824878076 that Nuno Marquez have not ultimate the transition from ROS1 to ROS2 even if there is a branch https://github.com/PX4/PX4-Avoidance/tree/ros2 and there’s no one else working on this.

What are the actual solution to perform Obstacle Avoidance with ROS2?
There are other non official package that can perform this?

The query is whether obstacle sensing ever worked using PX4 !!

Well on my ROS1 UAV was working well, not perfec, but the UAV havent collide a single time with GPS signal.
@sibujacob do you know any ROS2 Package that can do what I need?

@Cristian-wp I am working on a ros2 implementation of avoidance that would replace the current px4-avoidance repository. However, I do not have a planned delivery date.

In what context are you trying to use it? Why do you need such an implementation?

@ Cristian …did you implement the obstacle sensing thro" a pixhawk fc directly or thro" companion computer like RasPi or Arduino.
I would love to get some details about this setup either way. Unfortunately i am far away from doing any ROS 2 application for the moment

@sibujacob Is not possible to use obstacle avoidance without a companion computer, in my case I had use an old Intel NUC and a Realsense D435i. I have connected PC and fly controller with an FDI converter for UART (the same reported on PX4-Avoidance github page).

For my knowledge the only obstacle sensing that can be used without a companion computer is the collision prevention, but you need to connect the sensor with Pixhawk i2c port, and use only the predefined sensors for PX4(because the driver are already present in the firmware) such as: Garmin LidarLite v3, Terabee, ecc…

1 Like

Hi @Jaeyoung-Lim, Thanks for the information. :grinning:
I have to use that package in two way, but both will use the local planner :

  1. I need to fly in a dynamic enviroment (with GPS) and I need that my UAV can perform path replanning autonomousy if it detect an obstacle to reach the predefined waypoint.

  2. the reason is the same, but it will fly in GPS denied enviroment (I will use a SLAM for localization) with predefined waypoint loaded on the companion computer and seded to the fly controller with ROS topic or custom messages (I havent read the documentation on this last part yet)

Can you please roughly estimate when you might release your package?

Can you please suggest me another package (or more) that can be easily integrated or maybe is already integrated to work with ROS2 and PX4? Or maybe suggest me a procedure/documentation/ecc… to create my own avoidance that can communincate with PX4 fly controller?

thank you for the detailed feedback. I actually tried my hands using Vl53l0x (i2c) sensor as collision prevention along with puxhawk orange cube fc but unfortunately it didn’t work. QGC reads the distance sensor but collision prevention never activated. I had adjusted the parameters as detailed in px4 documentation. I wish you had some more info on any parameter that i might have missed during my settings. The collision prevention trial operation was performed on a quadcopter in position mode with gps lock signal.

@sibujacob I am sorry but I have never work with collision prevention, I have only work with the collision avoidance package… I think you have already do this, but the only thing I suggest is read Collision Prevention | PX4 User Guide again and maybe try it on simulation with an IRIS drone

1 Like

@sibujacob If you are struggling with a setup issue or the documentation, please report the issue with detailed flight logs and instructions on how to reproduce the problem.

px4 is an opensource project, and benefits from reporting bugs and fixing it together


I see

I will be adding a global planner based on ompl, and from my side it is hard to make any promises on the timeline.

You can have a look at Obstacle Avoidance | PX4 User Guide for creating your own avoidance node.

On alternative packages, I am not sure what to suggest

Hi @Jaeyoung-Lim thank you for the fast reply.
I have just start lo learn OMPL (3 days to install all the correct dependencies for omplapp :smiling_face_with_tear:) exactly for this purpose.
I had read that there are not collision checker in OMPL, can you please suggest me one that can work with 360° lidar?
If is possible, can you please share with me some documentation relating the development of an obstacle avoidance algorithm with OMPL or other things that can be useful?

Yes, i am nearing to that stage . i had an issue on my quadcopter in general recently and am rectifying the issue further to which i shall report the same.
thank you

@Jaeyoung-Lim I would like to contribute in this project

Hi, I am also working on PX4 with ubuntu22.04 for indoor flying with V-SLAM, I am trying to do visual positioning, and I will also want to add cruise and obstacle avoidance in the future.

So far, I base on an offboard example from @Jaeyoung-Lim, trying to combine a V-SLAM to it.
This is a simple test, we are still working on the camera intrinsic problem on the gazebo plugin.

Although I am pretty new to PX4, we would like to join or contribute to the project if there is a chance.

@Jaeyoung-Lim I would like to contribute to this project as well, is there a possibility to conform a workgroup soon?

Hi @Jaeyoung-Lim there are any updates about porting Obstacle Avoidance on ROS2?

Hey all,

Wondering on what the status is for ROS2 support!

1 Like

Hello i am working in ubuntu 22.04 ros2 humble px4 sitl i want to perform object avoidance and path planning i am wondering if this GitHub - PX4/PX4-Avoidance: PX4 avoidance ROS node for obstacle detection and avoidance. would help me

ROS is an older version which doesn’t work on v1.14 and above. ROS2 is the new version but UXRCE-DDS works from version 1.14.0. ROS2 Fast RTPS_DDS may work if you have PX4 < 13.3