How to check if there is obstacle on path

asked 2021-09-22 08:24:12 -0500

ahopsu gravatar image

updated 2021-09-22 08:26:40 -0500


My goal would be to know, does ROS2 (Navigation2) provide some kind of ready "feature"/function, which could tell, if there is an obstacle on the path the robot is trying to follow, either on the whole path, or just some meters forward from robot's current position, using the costmap(s). image description

From example in the picture, the path is going through the cost cells, and the idea is, that the ROS2 (Navigation2) could some how tell that. The intention is not to calculate new route etc. I just want to know, if there is existing "obstacle detected" function?

edit retag flag offensive close merge delete


Really cool question! Maybe consider writing such a function your self if it would not already be included in nav2.

Of course, you first of all need to consider that there exists different paths in navigation2. The global path that takes the static (cost) map into account (which door to take etc.) and the local path planner typically only has like a 2x2m grid of space where it has the purpose of staying on the global path. I don't think that there is something like a: "check if there is an obstacle and if yes go around it". I think the planners are typically build like: "okay this is my path, and I want to stay on it with the lowest cost. If there is an object, this means cost. so I plan my local path arround it. if there is no cost on my way, than my local ...(more)

flo gravatar image flo  ( 2021-09-23 15:21:59 -0500 )edit

Hey, did you find a way to solve this question ? I'm trying to do excatly the same in a BT Node, but I'm struggling against how to get the global costmap and the collision checker in my node.

PatoInso gravatar image PatoInso  ( 2021-12-14 10:24:00 -0500 )edit

I think the information would need to be provided either directly by the cost map node or another node that always polls the current situation. But I believe that there does not exist an OSS solution for this problem based on a BT node already. Might be a a cool feature, please bring it up, if you solved this issue.

Maybe the original answerer solved this problem.

Kind regards

flo gravatar image flo  ( 2021-12-14 10:30:19 -0500 )edit

Hi! I have started implementing own logic/code for this purpose, which is still under developing. By the way, I just noticed, that there is an open issue in GitHub, which considers implementing this kind of feature natively for Navigation2:

ahopsu gravatar image ahopsu  ( 2021-12-14 11:08:51 -0500 )edit