Nav2 and costmap_2d nodes
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: https://github.com/ros-planning/navigation2/blob/main/nav2_controller/include/nav2_controller/controller_server.hpp#L216-L218
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 costmap2d node that subscribes to a 2D lidar scan and generates the local cost map... without success because it seems that the costmap2d 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...
Asked by Myzhar on 2022-12-16 03:49:34 UTC
Answers
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.
Asked by stevemacenski on 2022-12-19 18:53:41 UTC
Comments
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.
Asked by Myzhar on 2022-12-20 03:48:20 UTC
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.
Asked by stevemacenski on 2022-12-21 13:27:33 UTC
That's true, but it's not working as expected. The issue has been reported, but never fixed:
- https://github.com/ros-planning/navigation2/issues/3213
- https://answers.ros.org/question/397026/how-to-properly-use-nav2_costmap_2d-node/
Asked by Myzhar on 2022-12-21 14:13:56 UTC
There were pull requests clearly merged from that request.
Asked by stevemacenski on 2022-12-21 20:12:58 UTC
I tested it in ROS2 Humble and I faced the same issue:
```
local_costmap_node = Node(
package="nav2_costmap_2d",
executable="nav2_costmap_2d",
name="local_costmap",
namespace=namespace,
arguments=[],
parameters=[
# YAML file
local_costmap_config
],
output="screen",
)
```
name
and namespace
are ignored.
Asked by Myzhar on 2022-12-22 04:40:06 UTC
@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.
Asked by chives_onion on 2023-07-26 10:55:34 UTC
Comments