From 8a095a230378eb6692f185d4cd75a0eb0cb4defd Mon Sep 17 00:00:00 2001 From: pawelirh Date: Thu, 12 Sep 2024 09:20:04 +0200 Subject: [PATCH 1/4] Remove global prefix from diagnostics topic --- joy2twist/launch/gamepad_controller.launch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/joy2twist/launch/gamepad_controller.launch.py b/joy2twist/launch/gamepad_controller.launch.py index 520d8bb..0f606a8 100644 --- a/joy2twist/launch/gamepad_controller.launch.py +++ b/joy2twist/launch/gamepad_controller.launch.py @@ -40,7 +40,8 @@ def generate_launch_description(): executable="joy_linux_node", # output={"stdout": "screen", "stderr": "screen"}, emulate_tty="true", - namespace=namespace + namespace=namespace, + remappings=[("/diagnostics", "diagnostics")], ) actions = [declare_namespace_arg, joy2twist_params_file_argument, joy2twist_launch, joy_linux_node] From fea4081b0375b85f8b3c11d2fc987c5458494f1f Mon Sep 17 00:00:00 2001 From: pawelirh Date: Thu, 12 Sep 2024 09:20:45 +0200 Subject: [PATCH 2/4] Format launch files --- joy2twist/launch/gamepad_controller.launch.py | 13 +++++++++++-- joy2twist/launch/joy2twist.launch.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/joy2twist/launch/gamepad_controller.launch.py b/joy2twist/launch/gamepad_controller.launch.py index 0f606a8..559fe13 100644 --- a/joy2twist/launch/gamepad_controller.launch.py +++ b/joy2twist/launch/gamepad_controller.launch.py @@ -27,7 +27,11 @@ def generate_launch_description(): joy2twist_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare("joy2twist"), "launch", "joy2twist.launch.py"])] + [ + PathJoinSubstitution( + [FindPackageShare("joy2twist"), "launch", "joy2twist.launch.py"] + ) + ] ), launch_arguments={ "joy2twist_params_file": LaunchConfiguration("joy2twist_params_file"), @@ -44,6 +48,11 @@ def generate_launch_description(): remappings=[("/diagnostics", "diagnostics")], ) - actions = [declare_namespace_arg, joy2twist_params_file_argument, joy2twist_launch, joy_linux_node] + actions = [ + declare_namespace_arg, + joy2twist_params_file_argument, + joy2twist_launch, + joy_linux_node, + ] return LaunchDescription(actions) diff --git a/joy2twist/launch/joy2twist.launch.py b/joy2twist/launch/joy2twist.launch.py index fea2f0b..c278988 100644 --- a/joy2twist/launch/joy2twist.launch.py +++ b/joy2twist/launch/joy2twist.launch.py @@ -30,7 +30,7 @@ def generate_launch_description(): parameters=[LaunchConfiguration("joy2twist_params_file")], # output={"stdout": "screen", "stderr": "screen"}, emulate_tty="true", - namespace=namespace + namespace=namespace, ) actions = [declare_namespace_arg, joy2twist_params_file_argument, joy2twist_node] From 0d38e496dd54cf34f5426311c53c424127e4fca2 Mon Sep 17 00:00:00 2001 From: pawelirh Date: Thu, 12 Sep 2024 09:25:40 +0200 Subject: [PATCH 3/4] Format readme file --- README.md | 61 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 506be12..03d0a24 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Connect joy via nano USB receiver and make sure it is in **DirectInput Mode** (s To test if joy works, use `jstest /dev/input/js0`. If the output is: -``` +```bash jstest: No such file or directory ``` @@ -38,20 +38,21 @@ By default, linear `X` and `Y` are held by the left stick. Angular `Z` is contro | `B` | Trigger E-stop | | `LT` | Enable E-stop reset | -> [!NOTE] +> [!NOTE] > Handle of robot's emergency stop is available only when `~e_stop/present` parameter is set true. This functionality will work with any robot configured as follows: +> > - publishes robot's E-stop state uisng ROS topic of type `std_msgs/Bool`. > - allows resetting robot's E-stop using ROS service of type `std_srvs/Trigger`. > - allows triggering robot's E-stop using ROS service of type `std_srvs/Trigger`. -> +> > Topic and services names can be configured using ROS parameters, see [Parameters](#parameters) for more info. --- + ## ROS node API ROS node is translating `/joy` topic to `/cmd_vel` topic. - ### Publish - `/cmd_vel` *(geometry_msgs/Twist)* @@ -98,38 +99,38 @@ Available on [Docker Hub](https://hub.docker.com/r/husarion/joy2twist/tags) 1. Flash the right firmware: -```bash -docker stop rosbot-xl microros || true && \ -docker run --rm -it --privileged \ ---mount type=bind,source=/dev/ttyUSBDB,target=/dev/ttyUSBDB \ -husarion/rosbot-xl:humble-0.8.2-20230913 \ -flash-firmware.py -p /dev/ttyUSBDB -``` + ```bash + docker stop rosbot-xl microros || true && \ + docker run --rm -it --privileged \ + --mount type=bind,source=/dev/ttyUSBDB,target=/dev/ttyUSBDB \ + husarion/rosbot-xl:humble-0.8.2-20230913 \ + flash-firmware.py -p /dev/ttyUSBDB + ``` -2. Connect Logitech F710 dongle to the ROSbot XL and run (on ROSbot): +1. Connect Logitech F710 dongle to the ROSbot XL and run (on ROSbot): -```bash -cd joy2twist/demo/single_robot -docker compose -f compose.rosbotxl.yaml up -``` + ```bash + cd joy2twist/demo/single_robot + docker compose -f compose.rosbotxl.yaml up + ``` ### Controlling ROSbot 2R with a Logitech F710 Gamepad 1. Flash the right firmware: -```bash -docker stop rosbot microros || true && docker run \ ---rm -it --privileged \ -husarion/rosbot:humble-0.6.1-20230712 \ -flash-firmware.py /root/firmware.bin -``` + ```bash + docker stop rosbot microros || true && docker run \ + --rm -it --privileged \ + husarion/rosbot:humble-0.6.1-20230712 \ + flash-firmware.py /root/firmware.bin + ``` -2. Connect Logitech F710 dongle to the ROSbot 2R and run (on ROSbot): +1. Connect Logitech F710 dongle to the ROSbot 2R and run (on ROSbot): -```bash -cd joy2twist/demo/single_robot -docker compose -f compose.rosbot2r.yaml up -``` + ```bash + cd joy2twist/demo/single_robot + docker compose -f compose.rosbot2r.yaml up + ``` ### Different namespace demo with a Logitech F710 gamepad @@ -160,20 +161,20 @@ docker compose -f compose.rosbot2r.yaml up > **Topic filtering** > > If you will then check on the PC the available ROS 2 nodes you will get: -> +> > ```bash > $ ros2 topic list > /parameter_events > /robot1/cmd_vel > /rosout > ``` -> +> > Note that nly the single `/robot1/cmd_vel` topic is available outside the robot thanks to the configuration from the `ros2router_config.yaml` file. > > To control the robot by using the teleop, just run: `ros2 run teleop_twist_keyboard teleop_twist_keyboard __ns:=/robot1` To run the `joy2twist` container execute the following command on your PC in the `joy2twist/demo/multiple_robots` directory: -``` +```bash docker compose -f compose.pc.yaml up ``` From 181556d60015799d6846aa40bee65fd8018388fb Mon Sep 17 00:00:00 2001 From: pawelirh Date: Thu, 12 Sep 2024 09:58:43 +0200 Subject: [PATCH 4/4] Correct topic names in readme file --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 03d0a24..01d3985 100644 --- a/README.md +++ b/README.md @@ -51,15 +51,15 @@ By default, linear `X` and `Y` are held by the left stick. Angular `Z` is contro ## ROS node API -ROS node is translating `/joy` topic to `/cmd_vel` topic. +ROS node is translating `joy` topic to `cmd_vel` topic. ### Publish -- `/cmd_vel` *(geometry_msgs/Twist)* +- `cmd_vel` *(geometry_msgs/Twist)* ### Subscribe -- `/joy` *(sensor_msgs/Joy)* +- `joy` *(sensor_msgs/Joy)* ### Parameters