ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Nav2 and costmap_2d nodes

asked 2022-12-16 02:49:34 -0500

Myzhar gravatar image

updated 2022-12-16 02:51:44 -0500

Hi all,

I'm trying to figure out how Nav2 is structured and I was searching for the launch files for the costmap_2d nodes that handle the local and the global cost maps.

I found that the nodes are not launched, but they are incorporated in the planner server or the control server that uses them.

For example here is where a node is declared inside the planner server:

Is there a reason for this hard-coded design when there is a powerful tool in ROS2 like IPC (Intra Process Communication) to be used?

For a personal exercise, I also tried to create my launch file for a costmap_2d node that subscribes to a 2D lidar scan and generates the local cost map... without success because it seems that the costmap_2d node does not work like any other nodes (for example, the namespace and node name parameters in the launch file are ignored). But this is a topic for another eventual thread...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-12-19 17:53:41 -0500

updated 2022-12-19 17:54:48 -0500

Low-latency, direct-memory access is important for environmental models so that delays in communication don't result in collisions since it takes non-zero time for the data to be communicated over the network - reducing emergency situation response time.

It could have been in a separate process, but there wasn't a strong reason to do so. But there are compelling reasons why not to do so.

edit flag offensive delete link more


Hi Steve, thanks for the reply. This makes sense, but I think that it would also be useful to use it in a non-"hardcoded" way, by launching it as a standalone node, for example for assisted teleops that don't require path planning.

Myzhar gravatar image Myzhar  ( 2022-12-20 02:48:20 -0500 )edit

There is also a stand-alone node option! Its just not launched by default but there is totally that option available and folks do use it.

stevemacenski gravatar image stevemacenski  ( 2022-12-21 12:27:33 -0500 )edit

That's true, but it's not working as expected. The issue has been reported, but never fixed:

Myzhar gravatar image Myzhar  ( 2022-12-21 13:13:56 -0500 )edit

There were pull requests clearly merged from that request.

stevemacenski gravatar image stevemacenski  ( 2022-12-21 19:12:58 -0500 )edit

I tested it in ROS2 Humble and I faced the same issue:


local_costmap_node = Node(







        # YAML file






name and namespace are ignored.

Myzhar gravatar image Myzhar  ( 2022-12-22 03:40:06 -0500 )edit

@Myzhar have you tried compiling nav2_costmap_2d from source? It takes time for changes to make it into deb packages, and even most of a year after the PR mentioned by steve an inspection of the latest package manifest reveals that the deb doesn't have the desired fixes.

chives_onion gravatar image chives_onion  ( 2023-07-26 10:55:34 -0500 )edit

Question Tools

1 follower


Asked: 2022-12-16 02:49:34 -0500

Seen: 220 times

Last updated: Dec 19 '22