From 18f43a3af261b8ad453a2d78f57e5ac2deebdc50 Mon Sep 17 00:00:00 2001 From: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:56:59 +0200 Subject: [PATCH] Add ROBOT_NAMESPACE env (#23) * Add ROBOT_NAMESPACE env * Rename param j2t_panther -> j2t_ugv * Rename all occurrence --- README.md | 2 +- demo/single_robot/compose.panther.yaml | 4 ++-- .../config/{joy2twist_panther.yaml => joy2twist_ugv.yaml} | 0 joy2twist/launch/gamepad_controller.launch.py | 7 +++---- joy2twist/launch/joy2twist.launch.py | 7 +++---- 5 files changed, 9 insertions(+), 11 deletions(-) rename joy2twist/config/{joy2twist_panther.yaml => joy2twist_ugv.yaml} (100%) diff --git a/README.md b/README.md index 01d3985..39b5943 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ The robot can be operated at 3 scales of speed depending on pressed buttons. It' - `regular` *(float, default: 0.5)* - `slow` *(float, default: 0.2)* -The node can be configured using parameters described below to work with robots equipped with an E-stop interface. An example configuration for a robot with an E-stop interface can be found in [panther config file](./joy2twist/config/joy2twist_panther.yaml). +The node can be configured using parameters described below to work with robots equipped with an E-stop interface. An example configuration for a robot with an E-stop interface can be found in [panther config file](./joy2twist/config/joy2twist_ugv.yaml). - `~e_stop/present` *(bool, default: false)* - `~e_stop/topic` *(string, default: e_stop)* diff --git a/demo/single_robot/compose.panther.yaml b/demo/single_robot/compose.panther.yaml index 84a4b36..bdaed17 100644 --- a/demo/single_robot/compose.panther.yaml +++ b/demo/single_robot/compose.panther.yaml @@ -9,7 +9,7 @@ services: devices: - /dev/input/js0 volumes: - - ./../../joy2twist/config/joy2twist_panther.yaml:/joy2twist_panther.yaml + - ./../../joy2twist/config/joy2twist_ugv.yaml:/joy2twist_ugv.yaml command: > ros2 launch joy2twist gamepad_controller.launch.py - joy2twist_params_file:=/joy2twist_panther.yaml + joy2twist_params_file:=/joy2twist_ugv.yaml diff --git a/joy2twist/config/joy2twist_panther.yaml b/joy2twist/config/joy2twist_ugv.yaml similarity index 100% rename from joy2twist/config/joy2twist_panther.yaml rename to joy2twist/config/joy2twist_ugv.yaml diff --git a/joy2twist/launch/gamepad_controller.launch.py b/joy2twist/launch/gamepad_controller.launch.py index 559fe13..f0e3f0e 100644 --- a/joy2twist/launch/gamepad_controller.launch.py +++ b/joy2twist/launch/gamepad_controller.launch.py @@ -4,15 +4,15 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration, PathJoinSubstitution +from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution def generate_launch_description(): namespace = LaunchConfiguration("namespace") declare_namespace_arg = DeclareLaunchArgument( "namespace", - default_value="", - description="Namespace for all topics and tfs", + default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""), + description="Add namespace to all launched nodes.", ) joy2twist_cfg_path = PathJoinSubstitution( @@ -42,7 +42,6 @@ def generate_launch_description(): joy_linux_node = Node( package="joy_linux", executable="joy_linux_node", - # output={"stdout": "screen", "stderr": "screen"}, emulate_tty="true", namespace=namespace, remappings=[("/diagnostics", "diagnostics")], diff --git a/joy2twist/launch/joy2twist.launch.py b/joy2twist/launch/joy2twist.launch.py index c278988..2c870fd 100644 --- a/joy2twist/launch/joy2twist.launch.py +++ b/joy2twist/launch/joy2twist.launch.py @@ -3,15 +3,15 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration, PathJoinSubstitution +from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution def generate_launch_description(): namespace = LaunchConfiguration("namespace") declare_namespace_arg = DeclareLaunchArgument( "namespace", - default_value="", - description="Namespace for all topics and tfs", + default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""), + description="Add namespace to all launched nodes.", ) joy2twist_cfg_path = PathJoinSubstitution( @@ -28,7 +28,6 @@ def generate_launch_description(): package="joy2twist", executable="joy2twist", parameters=[LaunchConfiguration("joy2twist_params_file")], - # output={"stdout": "screen", "stderr": "screen"}, emulate_tty="true", namespace=namespace, )