Skip to content

Commit

Permalink
load and launch the controllers
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde committed Mar 5, 2021
1 parent 65fc070 commit 105333d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion rrbot_gazebo/launch/rrbot_world.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.launch_description_sources import PythonLaunchDescriptionSource

import xacro
Expand Down Expand Up @@ -86,6 +87,16 @@ def generate_launch_description():
'-entity', 'rrbot'],
output='screen')

load_joint_state_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_start_controller', 'joint_state_controller'],
output='screen'
)

load_joint_trajectory_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_start_controller', 'joint_trajectory_controller'],
output='screen'
)

# Static TF
static_tf = Node(package='tf2_ros',
executable='static_transform_publisher',
Expand All @@ -94,6 +105,18 @@ def generate_launch_description():
arguments=['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'world', 'link1'])

return LaunchDescription([
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
on_exit=[load_joint_trajectory_controller],
)
),
gazebo,
node_robot_state_publisher,
static_tf,
Expand Down

0 comments on commit 105333d

Please sign in to comment.