Skip to content

Commit

Permalink
Add ROBOT_NAMESPACE env (#23)
Browse files Browse the repository at this point in the history
* Add ROBOT_NAMESPACE env

* Rename param j2t_panther -> j2t_ugv

* Rename all occurrence
  • Loading branch information
rafal-gorecki authored Oct 3, 2024
1 parent 577a59e commit 18f43a3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)*
Expand Down
4 changes: 2 additions & 2 deletions demo/single_robot/compose.panther.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
7 changes: 3 additions & 4 deletions joy2twist/launch/gamepad_controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")],
Expand Down
7 changes: 3 additions & 4 deletions joy2twist/launch/joy2twist.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
)
Expand Down

0 comments on commit 18f43a3

Please sign in to comment.