Skip to content

Commit

Permalink
Give the controller type as parameter in ctrl namespace (#502)
Browse files Browse the repository at this point in the history
* Give the controller type as parameter in ctrl namespace

* Update type parameters for ex15

* Remove namespaces from controllers

* Add spawner namespacing and also add the missing --params-file path

* add missing parameter namespaces in config files

* Add --param-file to the spawners

* add missing comma separation

---------

Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
  • Loading branch information
christophfroehlich and saikishor authored Jul 30, 2024
1 parent 0ba16d2 commit 902b4bd
Show file tree
Hide file tree
Showing 34 changed files with 117 additions and 133 deletions.
9 changes: 3 additions & 6 deletions example_1/bringup/config/rrbot_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_position_controller:
type: forward_command_controller/ForwardCommandController

joint_trajectory_position_controller:
type: joint_trajectory_controller/JointTrajectoryController


forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- joint1
- joint2
Expand All @@ -22,6 +17,8 @@ forward_position_controller:

joint_trajectory_position_controller:
ros__parameters:
type: joint_trajectory_controller/JointTrajectoryController

joints:
- joint1
- joint2
Expand Down
4 changes: 2 additions & 2 deletions example_1/bringup/launch/rrbot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ def generate_launch_description():
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
arguments=["joint_state_broadcaster"],
)

robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["forward_position_controller", "--controller-manager", "/controller_manager"],
arguments=["forward_position_controller", "--param-file", robot_controllers],
)

# Delay rviz start after `joint_state_broadcaster`
Expand Down
8 changes: 2 additions & 6 deletions example_10/bringup/config/rrbot_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_position_controller:
type: forward_command_controller/ForwardCommandController

gpio_controller:
type: ros2_control_demo_example_10/GPIOController


forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- joint1
- joint2
interface_name: position

gpio_controller:
ros__parameters:
type: ros2_control_demo_example_10/GPIOController
inputs:
- flange_analog_IOs/analog_output1
- flange_analog_IOs/analog_input1
Expand Down
6 changes: 3 additions & 3 deletions example_10/bringup/launch/rrbot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ def generate_launch_description():
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
arguments=["joint_state_broadcaster"],
)

robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["forward_position_controller", "-c", "/controller_manager"],
arguments=["forward_position_controller", "--param-file", robot_controllers],
)

gpio_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["gpio_controller", "-c", "/controller_manager"],
arguments=["gpio_controller", "--param-file", robot_controllers],
)

# Delay start of joint_state_broadcaster after `robot_controller`
Expand Down
4 changes: 1 addition & 3 deletions example_11/bringup/config/carlikebot_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

bicycle_steering_controller:
type: bicycle_steering_controller/BicycleSteeringController


bicycle_steering_controller:
ros__parameters:
type: bicycle_steering_controller/BicycleSteeringController
wheelbase: 0.325
front_wheel_radius: 0.05
rear_wheel_radius: 0.05
Expand Down
4 changes: 2 additions & 2 deletions example_11/bringup/launch/carlikebot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def generate_launch_description():
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
arguments=["joint_state_broadcaster"],
)

robot_bicycle_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["bicycle_steering_controller", "--controller-manager", "/controller_manager"],
arguments=["bicycle_steering_controller", "--param-file", robot_controllers],
)

# Delay rviz start after `joint_state_broadcaster`
Expand Down
17 changes: 4 additions & 13 deletions example_12/bringup/config/rrbot_chained_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,30 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

joint1_position_controller:
type: passthrough_controller/PassthroughController

joint2_position_controller:
type: passthrough_controller/PassthroughController

position_controller:
type: passthrough_controller/PassthroughController

forward_position_controller:
type: forward_command_controller/ForwardCommandController

# First-level controllers
joint1_position_controller:
ros__parameters:
type: passthrough_controller/PassthroughController
interfaces: ["joint1/position"]


joint2_position_controller:
ros__parameters:
type: passthrough_controller/PassthroughController
interfaces: ["joint2/position"]


# Second-level controller
position_controller:
ros__parameters:
type: passthrough_controller/PassthroughController
interfaces:
- joint1_position_controller/joint1/position
- joint2_position_controller/joint2/position

# Third-level controllers
forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- position_controller/joint1_position_controller/joint1
- position_controller/joint2_position_controller/joint2
Expand Down
14 changes: 12 additions & 2 deletions example_12/bringup/launch/launch_chained_controllers.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,31 @@
from launch import LaunchDescription
from launch.actions import RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():

robot_controllers = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_example_12"),
"config",
"rrbot_chained_controllers.yaml",
]
)

position_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["position_controller", "--controller-manager", "/controller_manager"],
arguments=["position_controller", "--param-file", robot_controllers],
)

forward_position_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["forward_position_controller", "--controller-manager", "/controller_manager"],
arguments=["forward_position_controller", "--param-file", robot_controllers],
)

# Delay start of forward_position_controller_spawner after `position_controller_spawner`
Expand Down
6 changes: 3 additions & 3 deletions example_12/bringup/launch/rrbot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ def generate_launch_description():
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
arguments=["joint_state_broadcaster"],
)

j1_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint1_position_controller", "--controller-manager", "/controller_manager"],
arguments=["joint1_position_controller", "--param-file", robot_controllers],
)

j2_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint2_position_controller", "--controller-manager", "/controller_manager"],
arguments=["joint2_position_controller", "--param-file", robot_controllers],
)

# Delay rviz start after `joint_state_broadcaster`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_velocity_controller:
type: forward_command_controller/ForwardCommandController


forward_velocity_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- joint1
- joint2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ def generate_launch_description():
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
arguments=["joint_state_broadcaster"],
)

robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=[robot_controller, "--controller-manager", "/controller_manager"],
arguments=[robot_controller, "--param-file", robot_controllers],
)

# Delay rviz start after `joint_state_broadcaster`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_position_controller:
type: forward_command_controller/ForwardCommandController

position_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController


/rrbot_1/forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- rrbot_1_joint1
- rrbot_1_joint2
Expand All @@ -22,6 +17,7 @@

/rrbot_1/position_trajectory_controller:
ros__parameters:
type: joint_trajectory_controller/JointTrajectoryController
joints:
- rrbot_1_joint1
- rrbot_1_joint2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_position_controller:
type: forward_command_controller/ForwardCommandController

position_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController


/rrbot_2/forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- rrbot_2_joint1
- rrbot_2_joint2
Expand All @@ -22,6 +17,7 @@

/rrbot_2/position_trajectory_controller:
ros__parameters:
type: joint_trajectory_controller/JointTrajectoryController
joints:
- rrbot_2_joint1
- rrbot_2_joint2
Expand Down
8 changes: 2 additions & 6 deletions example_15/bringup/config/rrbot_namespace_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

forward_position_controller:
type: forward_command_controller/ForwardCommandController

position_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController


/rrbot/forward_position_controller:
ros__parameters:
type: forward_command_controller/ForwardCommandController
joints:
- joint1
- joint2
Expand All @@ -22,6 +17,7 @@

/rrbot/position_trajectory_controller:
ros__parameters:
type: joint_trajectory_controller/JointTrajectoryController
joints:
- joint1
- joint2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,18 @@ def generate_launch_description():
rrbot_1_position_trajectory_controller_spawner = Node(
package="controller_manager",
executable="spawner",
namespace="rrbot_1",
arguments=[
"position_trajectory_controller",
"-c",
"/rrbot_1/controller_manager",
"--inactive",
"--param-file",
PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_example_15"),
"config",
"multi_controller_manager_rrbot_1_controllers.yaml",
]
),
],
)

Expand All @@ -119,11 +126,18 @@ def generate_launch_description():
rrbot_2_position_trajectory_controller_spawner = Node(
package="controller_manager",
executable="spawner",
namespace="rrbot_2",
arguments=[
"position_trajectory_controller",
"-c",
"/rrbot_2/controller_manager",
"--inactive",
"--param-file",
PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_example_15"),
"config",
"multi_controller_manager_rrbot_2_controllers.yaml",
]
),
],
)

Expand Down
8 changes: 7 additions & 1 deletion example_15/bringup/launch/rrbot_base.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ def generate_launch_description():
package="controller_manager",
executable="spawner",
namespace=namespace,
arguments=[robot_controller, "-c", controller_manager_name],
arguments=[
robot_controller,
"-c",
controller_manager_name,
"--param-file",
robot_controllers,
],
)

# Delay rviz start after `joint_state_broadcaster`
Expand Down
Loading

0 comments on commit 902b4bd

Please sign in to comment.