Skip to content
Open
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 10 # Hz

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

pid_controller_left_wheel_joint:
type: pid_controller/PidController

pid_controller_right_wheel_joint:
type: pid_controller/PidController

diffbot_base_controller:
type: diff_drive_controller/DiffDriveController


pid_controller_left_wheel_joint:
ros__parameters:

dof_names:
- left_wheel_joint

command_interface: velocity

reference_and_state_interfaces:
- velocity

gains:
# control the velocity, no d term
left_wheel_joint: {"p": 0.5, "i": 2.5, "d": 0.0, "i_clamp_min": -20.0, "i_clamp_max": 20.0, "antiwindup": true, "feedforward_gain": 0.95}

pid_controller_right_wheel_joint:
ros__parameters:

dof_names:
- right_wheel_joint

command_interface: velocity

reference_and_state_interfaces:
- velocity

gains:
# control the velocity, no d term
right_wheel_joint: {"p": 0.5, "i": 2.5, "d": 0.0, "i_clamp_min": -20.0, "i_clamp_max": 20.0, "antiwindup": true, "feedforward_gain": 0.95}

diffbot_base_controller:
ros__parameters:
type: diff_drive_controller/DiffDriveController

left_wheel_names: ["pid_controller_left_wheel_joint/left_wheel_joint"]
right_wheel_names: ["pid_controller_right_wheel_joint/right_wheel_joint"]
Expand Down
6 changes: 6 additions & 0 deletions example_16/bringup/config/diffbot_cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 10 # Hz

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
31 changes: 31 additions & 0 deletions example_16/bringup/config/pid_controllers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
pid_controller_left_wheel_joint:
ros__parameters:
type: pid_controller/PidController

dof_names:
- left_wheel_joint

command_interface: velocity

reference_and_state_interfaces:
- velocity

gains:
# control the velocity, no d term
left_wheel_joint: {"p": 0.5, "i": 2.5, "d": 0.0, "i_clamp_min": -20.0, "i_clamp_max": 20.0, "antiwindup": true, "feedforward_gain": 0.95}

pid_controller_right_wheel_joint:
ros__parameters:
type: pid_controller/PidController

dof_names:
- right_wheel_joint

command_interface: velocity

reference_and_state_interfaces:
- velocity

gains:
# control the velocity, no d term
right_wheel_joint: {"p": 0.5, "i": 2.5, "d": 0.0, "i_clamp_min": -20.0, "i_clamp_max": 20.0, "antiwindup": true, "feedforward_gain": 0.95}
34 changes: 29 additions & 5 deletions example_16/bringup/launch/diffbot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def generate_launch_description():
parameters=[
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "diffbot_chained_controllers.yaml"
/ "diffbot_cm.yaml"
],
output="both",
),
Expand Down Expand Up @@ -91,14 +91,38 @@ def generate_launch_description():
executable="spawner",
name="controller_spawner",
arguments=[
"--controller",
"joint_state_broadcaster",
"pid_controller_left_wheel_joint",
"--param-file",
[
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "diffbot_cm.yaml"
],
"--controller",
"pid_controller_right_wheel_joint",
"--param-file",
[
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "pid_controllers.yaml",
],
"--controller",
"pid_controller_left_wheel_joint",
"--param-file",
[
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "pid_controllers.yaml",
],
"--controller",
"diffbot_base_controller",
"--param-file",
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "diffbot_chained_controllers.yaml",
[
PathSubstitution(FindPackageShare("ros2_control_demo_example_16"))
/ "config"
/ "diff_drive_controller.yaml",
],
"--controller-ros-args",
"-r /diffbot_base_controller/cmd_vel:=/cmd_vel",
],
Expand Down
Loading