Skip to content

Commit

Permalink
refactor(joy_controller): rework parameters (autowarefoundation#3992)
Browse files Browse the repository at this point in the history
* refactor(joy_controller): rework parameters

Updated adding a schema according to new ROS node config coding
guidelines.

Signed-off-by: kaspermeck-arm <kasper.mecklenburg@arm.com>
Change-Id: Icf76852cd102bf70a27f7d4111f1b52de087a00d

* refactor(joy_controller): rework parameters

Updated adding a schema according to new ROS node config coding
guidelines.

Signed-off-by: kaspermeck-arm <kasper.mecklenburg@arm.com>
Change-Id: Icf76852cd102bf70a27f7d4111f1b52de087a00d

* Apply suggestions from code review

Co-authored-by: Ryohsuke Mitsudome <43976834+mitsudome-r@users.noreply.github.com>

* Added quotes for default values

Signed-off-by: kaspermeck-arm <kasper.mecklenburg@arm.com>
Change-Id: Ib754b9400003c0871ee1dd9bda8db07215852a78

---------

Signed-off-by: kaspermeck-arm <kasper.mecklenburg@arm.com>
Co-authored-by: Ryohsuke Mitsudome <43976834+mitsudome-r@users.noreply.github.com>
Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 17, 2023
1 parent 81a1e53 commit 1b10386
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
1 change: 1 addition & 0 deletions control/joy_controller/config/joy_controller.param.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**:
ros__parameters:
joy_type: DS4
update_rate: 10.0
accel_ratio: 3.0
brake_ratio: 5.0
Expand Down
118 changes: 118 additions & 0 deletions control/joy_controller/schema/joy_controller.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for Joy Controller node",
"type": "object",
"definitions": {
"joy_controller": {
"type": "object",
"properties": {
"joy_type": {
"type": "string",
"description": "Joy controller type",
"default": "DS4",
"enum": ["P65", "DS4", "G29"]
},
"update_rate": {
"type": "number",
"description": "Update rate to publish control commands",
"default": "10.0",
"exclusiveMinimum": 0
},
"accel_ratio": {
"type": "number",
"description": "Ratio to calculate acceleration (commanded acceleration is ratio * operation)",
"default": "3.0"
},
"brake_ratio": {
"type": "number",
"description": "Ratio to calculate deceleration (commanded acceleration is -ratio * operation)",
"default": "5.0"
},
"steer_ratio": {
"type": "number",
"description": "Ratio to calculate deceleration (commanded steer is ratio * operation)",
"default": "0.5"
},
"steering_angle_velocity": {
"type": "number",
"description": "Steering angle velocity for operation",
"default": "0.1"
},
"accel_sensitivity": {
"type": "number",
"description": "Sensitivity to calculate acceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity))",
"default": "1.0",
"maximum": 1.0,
"exclusiveMinimum": 0.0
},
"brake_sensitivity": {
"type": "number",
"description": "Sensitivity to calculate deceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity))",
"default": "1.0",
"maximum": 1.0,
"exclusiveMinimum": 0.0
},
"control_command": {
"type": "object",
"properties": {
"velocity_gain": {
"type": "number",
"description": "Ratio to calculate velocity by acceleration",
"default": "3.0"
},
"max_forward_velocity": {
"type": "number",
"description": "Absolute max velocity to go forward",
"default": "20.0",
"minimum": 0
},
"max_backward_velocity": {
"type": "number",
"description": "Absolute max velocity to go backward",
"default": "3.0",
"minimum": 0
},
"backward_accel_ratio": {
"type": "number",
"description": "Ratio to calculate deceleration (commanded acceleration is -ratio * operation)",
"default": "1.0"
}
},
"required": [
"velocity_gain",
"max_forward_velocity",
"max_backward_velocity",
"backward_accel_ratio"
],
"additionalProperties": false
}
},
"required": [
"joy_type",
"update_rate",
"accel_ratio",
"brake_ratio",
"steer_ratio",
"steering_angle_velocity",
"accel_sensitivity",
"brake_sensitivity",
"control_command"
],
"additionalProperties": false
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/joy_controller"
}
},
"required": ["ros__parameters"],
"additionalProperties": false
}
},
"required": ["/**"],
"additionalProperties": false
}

0 comments on commit 1b10386

Please sign in to comment.