From c51e62f94dba498a104ce8d7c55f028b55ba6c4d Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Mon, 8 Jul 2024 17:26:48 +0200 Subject: [PATCH] Namespace fix --- Dockerfile | 4 +++- demo/config/nmea_navsat_params.yaml | 2 +- demo/nmea_navsat.launch.py | 16 +++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6bf7b4..d3e2857 100755 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,9 @@ SHELL ["/bin/bash", "-c"] WORKDIR /ros2_ws RUN apt-get update && apt-get install -y \ - ros-dev-tools python3-transforms3d && \ + nav2_common \ + python3-transforms3d \ + ros-dev-tools && \ git clone -b ros2 https://github.com/ros-drivers/nmea_navsat_driver.git src/nmea_navsat_driver && \ rosdep init && \ rosdep update --rosdistro $ROS_DISTRO && \ diff --git a/demo/config/nmea_navsat_params.yaml b/demo/config/nmea_navsat_params.yaml index de7b761..0faf50f 100644 --- a/demo/config/nmea_navsat_params.yaml +++ b/demo/config/nmea_navsat_params.yaml @@ -1,5 +1,5 @@ --- -/**: +/**/: ros__parameters: ip: 10.15.20.2 port: 5000 diff --git a/demo/nmea_navsat.launch.py b/demo/nmea_navsat.launch.py index c5206a4..53c0559 100644 --- a/demo/nmea_navsat.launch.py +++ b/demo/nmea_navsat.launch.py @@ -16,12 +16,9 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch.substitutions import ( - EnvironmentVariable, - LaunchConfiguration, - PythonExpression, -) +from launch.substitutions import EnvironmentVariable, LaunchConfiguration from launch_ros.actions import Node +from nav2_common.launch import ReplaceString def generate_launch_description(): @@ -46,8 +43,9 @@ def generate_launch_description(): description="Namespace to all launched nodes and use namespace as tf_prefix. This aids in differentiating between multiple robots with the same devices.", ) - tf_prefix = PythonExpression( - ["'", robot_namespace, "/' if '", robot_namespace, "' != '' else ''"] + rename_params_file = ReplaceString( + source_file=params_file, + replacements={"": device_namespace, "//": "/"}, ) nmea_driver = Node( @@ -58,9 +56,9 @@ def generate_launch_description(): parameters=[ { "frame_id": device_namespace, - "tf_prefix": tf_prefix, + "tf_prefix": robot_namespace, }, - params_file, + rename_params_file, ], remappings=[ ("fix", "~/fix"),