Skip to content

Commit

Permalink
Adapt to joint_trajectory_controller changes (#136)
Browse files Browse the repository at this point in the history
* jtc config to controller_manager

* fix jic and ec controllers too

* simplify controller_spawner

* format

* fix typo in doc

---------

Co-authored-by: Aron Svastits <svastits1@gmail.com>
  • Loading branch information
Svastits and Aron Svastits authored Jan 11, 2024
1 parent 0e98be9 commit bf2c7b0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 42 deletions.
2 changes: 1 addition & 1 deletion doc/wiki/KSS_RSI.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Both launch files support the following arguments:
The `startup_with_rviz.launch.py` additionally contains one argument:
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/"view_6_axis_urdf.rviz`)
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/view_6_axis_urdf.rviz`)
#### Stopping external control
Expand Down
2 changes: 1 addition & 1 deletion doc/wiki/Sunrise_FRI.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Both launch files support the following argument:
The `startup_with_rviz.launch.py` additionally contains one argument:
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/"view_6_axis_urdf.rviz`)
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/view_6_axis_urdf.rviz`)
#### Stopping external control
Expand Down
2 changes: 1 addition & 1 deletion doc/wiki/iiQKA_EAC.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Both launch files support the following arguments:


The `startup_with_rviz.launch.py` additionally contains one argument:
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/"view_6_axis_urdf.rviz`)
- `rviz_config`: the location of the `rviz` configuration file (defaults to `kuka_resources/config/view_6_axis_urdf.rviz`)

#### Stopping external control

Expand Down
2 changes: 1 addition & 1 deletion kuka_iiqka_eac_driver/config/ros2_controller_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/controller_manager:
controller_manager:
ros__parameters:
update_rate: 250 # Hz

Expand Down
24 changes: 10 additions & 14 deletions kuka_iiqka_eac_driver/launch/startup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def launch_setup(context, *args, **kwargs):
namespace=ns,
package="kuka_drivers_core",
executable="control_node",
parameters=[robot_description, controller_config],
parameters=[robot_description, controller_config, jtc_config, jic_config, ec_config],
)
robot_manager_node = LifecycleNode(
name=["robot_manager"],
Expand All @@ -130,31 +130,27 @@ def launch_setup(context, *args, **kwargs):
)

# Spawn controllers
def controller_spawner(controller_with_config, activate=False):
def controller_spawner(controller_names, activate=False):
arg_list = [
controller_with_config[0],
controller_names,
"-c",
controller_manager_node,
"-p",
controller_with_config[1],
"-n",
ns,
]
if not activate:
arg_list.append("--inactive")
return Node(package="controller_manager", executable="spawner", arguments=arg_list)

controller_names_and_config = [
("joint_state_broadcaster", []),
("joint_trajectory_controller", jtc_config.perform(context)),
("joint_group_impedance_controller", jic_config.perform(context)),
("effort_controller", ec_config.perform(context)),
("control_mode_handler", []),
controller_names = [
"joint_state_broadcaster",
"joint_trajectory_controller",
"joint_group_impedance_controller",
"effort_controller",
"control_mode_handler",
]

controller_spawners = [
controller_spawner(controllers) for controllers in controller_names_and_config
]
controller_spawners = [controller_spawner(name) for name in controller_names]

nodes_to_start = [
control_node,
Expand Down
18 changes: 7 additions & 11 deletions kuka_kss_rsi_driver/launch/startup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def launch_setup(context, *args, **kwargs):
namespace=ns,
package="kuka_drivers_core",
executable="control_node",
parameters=[robot_description, controller_config],
parameters=[robot_description, controller_config, jtc_config],
)
robot_manager_node = LifecycleNode(
name=["robot_manager"],
Expand All @@ -115,28 +115,24 @@ def launch_setup(context, *args, **kwargs):
)

# Spawn controllers
def controller_spawner(controller_with_config, activate=False):
def controller_spawner(controller_names, activate=False):
arg_list = [
controller_with_config[0],
controller_names,
"-c",
controller_manager_node,
"-p",
controller_with_config[1],
"-n",
ns,
]
if not activate:
arg_list.append("--inactive")
return Node(package="controller_manager", executable="spawner", arguments=arg_list)

controller_names_and_config = [
("joint_state_broadcaster", []),
("joint_trajectory_controller", jtc_config.perform(context)),
controller_names = [
"joint_state_broadcaster",
"joint_trajectory_controller",
]

controller_spawners = [
controller_spawner(controllers) for controllers in controller_names_and_config
]
controller_spawners = [controller_spawner(name) for name in controller_names]

nodes_to_start = [
control_node,
Expand Down
22 changes: 9 additions & 13 deletions kuka_sunrise_fri_driver/launch/startup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def launch_setup(context, *args, **kwargs):
namespace=ns,
package="kuka_drivers_core",
executable="control_node",
parameters=[robot_description, controller_config],
parameters=[robot_description, controller_config, jtc_config],
)
robot_manager_node = LifecycleNode(
name=["robot_manager"],
Expand All @@ -117,30 +117,26 @@ def launch_setup(context, *args, **kwargs):
)

# Spawn controllers
def controller_spawner(controller_with_config, activate=False):
def controller_spawner(controller_names, activate=False):
arg_list = [
controller_with_config[0],
controller_names,
"-c",
controller_manager_node,
"-p",
controller_with_config[1],
"-n",
ns,
]
if not activate:
arg_list.append("--inactive")
return Node(package="controller_manager", executable="spawner", arguments=arg_list)

controller_names_and_config = [
("joint_state_broadcaster", []),
("joint_trajectory_controller", jtc_config.perform(context)),
("fri_configuration_controller", []),
("fri_state_broadcaster", []),
controller_names = [
"joint_state_broadcaster",
"joint_trajectory_controller",
"fri_configuration_controller",
"fri_state_broadcaster",
]

controller_spawners = [
controller_spawner(controllers) for controllers in controller_names_and_config
]
controller_spawners = [controller_spawner(name) for name in controller_names]

nodes_to_start = [
control_node,
Expand Down

0 comments on commit bf2c7b0

Please sign in to comment.