Skip to content

Commit

Permalink
fix(joy_controller): joy_type is only set from the param.yaml file (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#6475)

Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
xmfcx authored and karishma1911 committed Jun 3, 2024
1 parent 436945b commit 3fe9a5d
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 3 deletions.
15 changes: 15 additions & 0 deletions control/joy_controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_g29.param.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_p65.param.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_xbox.param.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions control/joy_controller/launch/joy_controller.launch.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<launch>
<arg name="joy_type" default="DS4" description="options: DS4, G29, P65, XBOX"/>
<arg name="external_cmd_source" default="remote" description="options: local, remote"/>

<arg name="input_joy" default="/joy"/>
Expand All @@ -13,7 +12,7 @@
<arg name="output_gate_mode" default="/control/gate_mode_cmd"/>
<arg name="output_vehicle_engage" default="/vehicle/engage"/>

<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller.param.yaml"/>
<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller_ds4.param.yaml"/>

<node pkg="joy_controller" exec="joy_controller" name="joy_controller" output="screen">
<remap from="input/joy" to="$(var input_joy)"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>
<arg name="joy_type" default="ds4" description="options: ds4, g29, p65, xbox"/>

<include file="$(find-pkg-share joy_controller)/launch/joy_controller.launch.xml">
<arg name="config_file" value="$(find-pkg-share joy_controller)/config/joy_controller_$(var joy_type).param.yaml"/>
</include>
</launch>

0 comments on commit 3fe9a5d

Please sign in to comment.