Skip to content

Commit

Permalink
Reduce number of controller_spawners to 3
Browse files Browse the repository at this point in the history
Since the controller_spawner supports a list of controllers since a while we can use this to reduce the number of total controllers.

(cherry picked from commit 31993ab)
  • Loading branch information
fmauch committed Apr 15, 2024
1 parent f6235d3 commit b35315c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ur_robot_driver/launch/ur_control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,31 +309,31 @@ def launch_setup(context, *args, **kwargs):
)

# Spawn controllers
def controller_spawner(name, active=True):
def controller_spawner(controllers, active=True):
inactive_flags = ["--inactive"] if not active else []
return Node(
package="controller_manager",
executable="spawner",
arguments=[
name,
"--controller-manager",
"/controller_manager",
"--controller-manager-timeout",
controller_spawner_timeout,
]
+ inactive_flags,
+ inactive_flags
+ controllers,
)

controller_spawner_names = [
controllers_active = [
"joint_state_broadcaster",
"io_and_status_controller",
"speed_scaling_state_broadcaster",
"force_torque_sensor_broadcaster",
]
controller_spawner_inactive_names = ["forward_position_controller"]
controllers_inactive = ["forward_position_controller"]

controller_spawners = [controller_spawner(name) for name in controller_spawner_names] + [
controller_spawner(name, active=False) for name in controller_spawner_inactive_names
controller_spawners = [controller_spawner(controllers_active)] + [
controller_spawner(controllers_inactive, active=False)
]

# There may be other controllers of the joints, but this is the initially-started one
Expand Down

0 comments on commit b35315c

Please sign in to comment.