Skip to content

Commit

Permalink
Namespace fix (#7)
Browse files Browse the repository at this point in the history
* Namespace fix

* nav2-common fix
  • Loading branch information
rafal-gorecki authored Jul 8, 2024
1 parent 65f4081 commit 1d393f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ SHELL ["/bin/bash", "-c"]
WORKDIR /ros2_ws

RUN apt-get update && apt-get install -y \
ros-dev-tools python3-transforms3d && \
python3-transforms3d \
ros-dev-tools \
ros-${ROS_DISTRO}-nav2-common && \
git clone -b ros2 https://github.com/ros-drivers/nmea_navsat_driver.git src/nmea_navsat_driver && \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
Expand Down
2 changes: 1 addition & 1 deletion demo/config/nmea_navsat_params.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
/**:
/**/<device_namespace>:
ros__parameters:
ip: 10.15.20.2
port: 5000
Expand Down
16 changes: 7 additions & 9 deletions demo/nmea_navsat.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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>": device_namespace, "//": "/"},
)

nmea_driver = Node(
Expand All @@ -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"),
Expand Down

0 comments on commit 1d393f8

Please sign in to comment.