From 3fe9a5d414ce03ccb67be8630e6534607ae6c356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Mon, 26 Feb 2024 20:38:00 +0300 Subject: [PATCH] fix(joy_controller): joy_type is only set from the param.yaml file (#6475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- control/joy_controller/README.md | 15 +++++++++++++++ ....param.yaml => joy_controller_ds4.param.yaml} | 2 +- .../config/joy_controller_g29.param.yaml | 16 ++++++++++++++++ .../config/joy_controller_p65.param.yaml | 16 ++++++++++++++++ .../config/joy_controller_xbox.param.yaml | 16 ++++++++++++++++ .../launch/joy_controller.launch.xml | 3 +-- .../joy_controller_param_selection.launch.xml | 7 +++++++ 7 files changed, 72 insertions(+), 3 deletions(-) rename control/joy_controller/config/{joy_controller.param.yaml => joy_controller_ds4.param.yaml} (92%) create mode 100644 control/joy_controller/config/joy_controller_g29.param.yaml create mode 100644 control/joy_controller/config/joy_controller_p65.param.yaml create mode 100644 control/joy_controller/config/joy_controller_xbox.param.yaml create mode 100644 control/joy_controller/launch/joy_controller_param_selection.launch.xml diff --git a/control/joy_controller/README.md b/control/joy_controller/README.md index b8ee8ad79a33d..4674ebdadb51d 100644 --- a/control/joy_controller/README.md +++ b/control/joy_controller/README.md @@ -4,6 +4,21 @@ `joy_controller` is the package to convert a joy msg to autoware commands (e.g. steering wheel, shift, turn signal, engage) for a vehicle. +## Usage + +### ROS 2 launch + +```bash +# With default config (ds4) +ros2 launch joy_controller joy_controller.launch.xml + +# Default config but select from the existing parameter files +ros2 launch joy_controller joy_controller_param_selection.launch.xml joy_type:=ds4 # or g29, p65, xbox + +# Override the param file +ros2 launch joy_controller joy_controller.launch.xml config_file:=/path/to/your/param.yaml +``` + ## Input / Output ### Input topics diff --git a/control/joy_controller/config/joy_controller.param.yaml b/control/joy_controller/config/joy_controller_ds4.param.yaml similarity index 92% rename from control/joy_controller/config/joy_controller.param.yaml rename to control/joy_controller/config/joy_controller_ds4.param.yaml index c9fe348867e68..73a5d028985c5 100644 --- a/control/joy_controller/config/joy_controller.param.yaml +++ b/control/joy_controller/config/joy_controller_ds4.param.yaml @@ -1,6 +1,6 @@ /**: ros__parameters: - joy_type: $(var joy_type) + joy_type: DS4 update_rate: 10.0 accel_ratio: 3.0 brake_ratio: 5.0 diff --git a/control/joy_controller/config/joy_controller_g29.param.yaml b/control/joy_controller/config/joy_controller_g29.param.yaml new file mode 100644 index 0000000000000..c28a6c01d1326 --- /dev/null +++ b/control/joy_controller/config/joy_controller_g29.param.yaml @@ -0,0 +1,16 @@ +/**: + ros__parameters: + joy_type: G29 + update_rate: 10.0 + accel_ratio: 3.0 + brake_ratio: 5.0 + steer_ratio: 0.5 + steering_angle_velocity: 0.1 + accel_sensitivity: 1.0 + brake_sensitivity: 1.0 + control_command: + raw_control: false + velocity_gain: 3.0 + max_forward_velocity: 20.0 + max_backward_velocity: 3.0 + backward_accel_ratio: 1.0 diff --git a/control/joy_controller/config/joy_controller_p65.param.yaml b/control/joy_controller/config/joy_controller_p65.param.yaml new file mode 100644 index 0000000000000..4b13348f95fb6 --- /dev/null +++ b/control/joy_controller/config/joy_controller_p65.param.yaml @@ -0,0 +1,16 @@ +/**: + ros__parameters: + joy_type: P65 + update_rate: 10.0 + accel_ratio: 3.0 + brake_ratio: 5.0 + steer_ratio: 0.5 + steering_angle_velocity: 0.1 + accel_sensitivity: 1.0 + brake_sensitivity: 1.0 + control_command: + raw_control: false + velocity_gain: 3.0 + max_forward_velocity: 20.0 + max_backward_velocity: 3.0 + backward_accel_ratio: 1.0 diff --git a/control/joy_controller/config/joy_controller_xbox.param.yaml b/control/joy_controller/config/joy_controller_xbox.param.yaml new file mode 100644 index 0000000000000..7b45c2c164454 --- /dev/null +++ b/control/joy_controller/config/joy_controller_xbox.param.yaml @@ -0,0 +1,16 @@ +/**: + ros__parameters: + joy_type: XBOX + update_rate: 10.0 + accel_ratio: 3.0 + brake_ratio: 5.0 + steer_ratio: 0.5 + steering_angle_velocity: 0.1 + accel_sensitivity: 1.0 + brake_sensitivity: 1.0 + control_command: + raw_control: false + velocity_gain: 3.0 + max_forward_velocity: 20.0 + max_backward_velocity: 3.0 + backward_accel_ratio: 1.0 diff --git a/control/joy_controller/launch/joy_controller.launch.xml b/control/joy_controller/launch/joy_controller.launch.xml index c392ca100a9c0..5236077680d0d 100644 --- a/control/joy_controller/launch/joy_controller.launch.xml +++ b/control/joy_controller/launch/joy_controller.launch.xml @@ -1,5 +1,4 @@ - @@ -13,7 +12,7 @@ - + diff --git a/control/joy_controller/launch/joy_controller_param_selection.launch.xml b/control/joy_controller/launch/joy_controller_param_selection.launch.xml new file mode 100644 index 0000000000000..d8e3d0bfe8b25 --- /dev/null +++ b/control/joy_controller/launch/joy_controller_param_selection.launch.xml @@ -0,0 +1,7 @@ + + + + + + +