diff --git a/gz_ros2_control_demos/launch/cart_example_position.launch.py b/gz_ros2_control_demos/launch/cart_example_position.launch.py deleted file mode 100644 index c4a78b3..0000000 --- a/gz_ros2_control_demos/launch/cart_example_position.launch.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2021 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription -from launch.actions import RegisterEventHandler -from launch.event_handlers import OnProcessExit -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - - -def generate_launch_description(): - # Launch Arguments - use_sim_time = LaunchConfiguration('use_sim_time', default=True) - - # Get URDF via xacro - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name='xacro')]), - ' ', - PathJoinSubstitution( - [FindPackageShare('gz_ros2_control_demos'), - 'urdf', 'test_cart_position.xacro.urdf'] - ), - ] - ) - robot_description = {'robot_description': robot_description_content} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare('gz_ros2_control_demos'), - 'config', - 'cart_controller_position.yaml', - ] - ) - - node_robot_state_publisher = Node( - package='robot_state_publisher', - executable='robot_state_publisher', - output='screen', - parameters=[robot_description] - ) - - gz_spawn_entity = Node( - package='ros_gz_sim', - executable='create', - output='screen', - arguments=['-topic', 'robot_description', - '-name', 'cart', '-allow_renaming', 'true'], - ) - - joint_state_broadcaster_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=['joint_state_broadcaster', - ], - ) - joint_trajectory_controller_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=[ - 'joint_trajectory_controller', - '--param-file', - robot_controllers, - ], - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], - output='screen' - ) - - return LaunchDescription([ - # Launch gazebo environment - IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare('ros_gz_sim'), - 'launch', - 'gz_sim.launch.py'])]), - launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=gz_spawn_entity, - on_exit=[joint_state_broadcaster_spawner], - ) - ), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=joint_state_broadcaster_spawner, - on_exit=[joint_trajectory_controller_spawner], - ) - ), - bridge, - node_robot_state_publisher, - gz_spawn_entity, - # Launch Arguments - DeclareLaunchArgument( - 'use_sim_time', - default_value=use_sim_time, - description='If true, use simulated clock'), - ]) diff --git a/gz_ros2_control_demos/launch/cart_example_velocity.launch.py b/gz_ros2_control_demos/launch/cart_example_velocity.launch.py deleted file mode 100644 index 4f0a040..0000000 --- a/gz_ros2_control_demos/launch/cart_example_velocity.launch.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 2021 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription -from launch.actions import RegisterEventHandler -from launch.event_handlers import OnProcessExit -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - - -def generate_launch_description(): - # Launch Arguments - use_sim_time = LaunchConfiguration('use_sim_time', default=True) - - # Get URDF via xacro - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name='xacro')]), - ' ', - PathJoinSubstitution( - [FindPackageShare('gz_ros2_control_demos'), - 'urdf', 'test_cart_velocity.xacro.urdf'] - ), - ] - ) - robot_description = {'robot_description': robot_description_content} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare('gz_ros2_control_demos'), - 'config', - 'cart_controller_velocity.yaml', - ] - ) - - node_robot_state_publisher = Node( - package='robot_state_publisher', - executable='robot_state_publisher', - output='screen', - parameters=[robot_description] - ) - - gz_spawn_entity = Node( - package='ros_gz_sim', - executable='create', - output='screen', - arguments=['-topic', 'robot_description', - '-name', 'cart', '-allow_renaming', 'true'], - ) - - joint_state_broadcaster_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=['joint_state_broadcaster'], - ) - velocity_controller_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=[ - 'velocity_controller', - '--param-file', - robot_controllers, - ], - ) - imu_sensor_broadcaster_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=[ - 'imu_sensor_broadcaster', - '--param-file', - robot_controllers, - ], - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], - output='screen' - ) - - return LaunchDescription([ - # Launch gazebo environment - IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare('ros_gz_sim'), - 'launch', - 'gz_sim.launch.py'])]), - launch_arguments=[('gz_args', [' -r -v 3 empty.sdf'])]), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=gz_spawn_entity, - on_exit=[joint_state_broadcaster_spawner], - ) - ), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=joint_state_broadcaster_spawner, - on_exit=[velocity_controller_spawner, - imu_sensor_broadcaster_spawner], - ) - ), - bridge, - node_robot_state_publisher, - gz_spawn_entity, - # Launch Arguments - DeclareLaunchArgument( - 'use_sim_time', - default_value=use_sim_time, - description='If true, use simulated clock'), - ]) diff --git a/gz_ros2_control_demos/launch/diff_drive_example.launch.py b/gz_ros2_control_demos/launch/diff_drive_example.launch.py deleted file mode 100644 index 21c5afb..0000000 --- a/gz_ros2_control_demos/launch/diff_drive_example.launch.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2022 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription -from launch.actions import RegisterEventHandler -from launch.event_handlers import OnProcessExit -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - - -def generate_launch_description(): - # Launch Arguments - use_sim_time = LaunchConfiguration('use_sim_time', default=True) - - # Get URDF via xacro - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name='xacro')]), - ' ', - PathJoinSubstitution( - [FindPackageShare('gz_ros2_control_demos'), - 'urdf', 'test_diff_drive.xacro.urdf'] - ), - ] - ) - robot_description = {'robot_description': robot_description_content} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare('gz_ros2_control_demos'), - 'config', - 'diff_drive_controller_velocity.yaml', - ] - ) - - node_robot_state_publisher = Node( - package='robot_state_publisher', - executable='robot_state_publisher', - output='screen', - parameters=[robot_description] - ) - - gz_spawn_entity = Node( - package='ros_gz_sim', - executable='create', - output='screen', - arguments=['-topic', 'robot_description', '-name', - 'diff_drive', '-allow_renaming', 'true'], - ) - - joint_state_broadcaster_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=['joint_state_broadcaster'], - ) - diff_drive_base_controller_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=[ - 'diff_drive_base_controller', - '--param-file', - robot_controllers, - ], - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], - output='screen' - ) - - return LaunchDescription([ - # Launch gazebo environment - IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare('ros_gz_sim'), - 'launch', - 'gz_sim.launch.py'])]), - launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=gz_spawn_entity, - on_exit=[joint_state_broadcaster_spawner], - ) - ), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=joint_state_broadcaster_spawner, - on_exit=[diff_drive_base_controller_spawner], - ) - ), - bridge, - node_robot_state_publisher, - gz_spawn_entity, - # Launch Arguments - DeclareLaunchArgument( - 'use_sim_time', - default_value=use_sim_time, - description='If true, use simulated clock'), - ]) diff --git a/gz_ros2_control_demos/launch/gripper_mimic_joint_example_effort.launch.py b/gz_ros2_control_demos/launch/gripper_mimic_joint_example_effort.launch.py deleted file mode 100644 index e074e86..0000000 --- a/gz_ros2_control_demos/launch/gripper_mimic_joint_example_effort.launch.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2022 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Author: Denis Stogl (Stogl Robotics Consulting) -# - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription -from launch.actions import RegisterEventHandler -from launch.event_handlers import OnProcessExit -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - - -def generate_launch_description(): - # Launch Arguments - use_sim_time = LaunchConfiguration('use_sim_time', default=True) - - # Get URDF via xacro - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name='xacro')]), - ' ', - PathJoinSubstitution( - [FindPackageShare('gz_ros2_control_demos'), - 'urdf', 'test_gripper_mimic_joint_effort.xacro.urdf'] - ), - ] - ) - robot_description = {'robot_description': robot_description_content} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare('gz_ros2_control_demos'), - 'config', - 'gripper_controller_effort.yaml', - ] - ) - - node_robot_state_publisher = Node( - package='robot_state_publisher', - executable='robot_state_publisher', - output='screen', - parameters=[robot_description] - ) - - gz_spawn_entity = Node( - package='ros_gz_sim', - executable='create', - output='screen', - arguments=['-topic', 'robot_description', '-name', - 'gripper', '-allow_renaming', 'true'], - ) - - joint_state_broadcaster_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=['joint_state_broadcaster'], - ) - gripper_controller_spawner = Node( - package='controller_manager', - executable='spawner', - arguments=[ - 'gripper_controller', - '--param-file', - robot_controllers, - ], - ) - - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], - output='screen' - ) - - return LaunchDescription([ - # Launch gazebo environment - IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare('ros_gz_sim'), - 'launch', - 'gz_sim.launch.py'])]), - launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=gz_spawn_entity, - on_exit=[joint_state_broadcaster_spawner], - ) - ), - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=joint_state_broadcaster_spawner, - on_exit=[gripper_controller_spawner], - ) - ), - bridge, - node_robot_state_publisher, - gz_spawn_entity, - # Launch Arguments - DeclareLaunchArgument( - 'use_sim_time', - default_value=use_sim_time, - description='If true, use simulated clock'), - ]) diff --git a/ign_ros2_control_demos/launch/ackermann_drive_example.launch.py b/ign_ros2_control_demos/launch/ackermann_drive_example.launch.py index a499604..5abdd03 100644 --- a/ign_ros2_control_demos/launch/ackermann_drive_example.launch.py +++ b/ign_ros2_control_demos/launch/ackermann_drive_example.launch.py @@ -75,14 +75,6 @@ def generate_launch_description(): output='screen' ) - # Bridge - bridge = Node( - package='ros_gz_bridge', - executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], - output='screen' - ) - return LaunchDescription([ bridge, # Launch gazebo environment diff --git a/ign_ros2_control_demos/launch/cart_example_position.launch.py b/ign_ros2_control_demos/launch/cart_example_position.launch.py index ffbeae6..aca8fff 100644 --- a/ign_ros2_control_demos/launch/cart_example_position.launch.py +++ b/ign_ros2_control_demos/launch/cart_example_position.launch.py @@ -72,6 +72,14 @@ def generate_launch_description(): output='screen' ) + # Bridge + bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], + output='screen' + ) + return LaunchDescription([ # Launch gazebo environment IncludeLaunchDescription( @@ -98,4 +106,5 @@ def generate_launch_description(): 'use_sim_time', default_value=use_sim_time, description='If true, use simulated clock'), + bridge, ]) diff --git a/ign_ros2_control_demos/launch/cart_example_velocity.launch.py b/ign_ros2_control_demos/launch/cart_example_velocity.launch.py index d69b413..f68e81f 100644 --- a/ign_ros2_control_demos/launch/cart_example_velocity.launch.py +++ b/ign_ros2_control_demos/launch/cart_example_velocity.launch.py @@ -77,6 +77,14 @@ def generate_launch_description(): output='screen' ) + # Bridge + bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'], + output='screen' + ) + return LaunchDescription([ # Launch gazebo environment IncludeLaunchDescription( @@ -109,4 +117,5 @@ def generate_launch_description(): 'use_sim_time', default_value=use_sim_time, description='If true, use simulated clock'), + bridge, ]) diff --git a/ign_ros2_control_demos/launch/diff_drive_example.launch.py b/ign_ros2_control_demos/launch/diff_drive_example.launch.py index d014716..7f742ac 100644 --- a/ign_ros2_control_demos/launch/diff_drive_example.launch.py +++ b/ign_ros2_control_demos/launch/diff_drive_example.launch.py @@ -1,17 +1,3 @@ -# Copyright 2022 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - import os from ament_index_python.packages import get_package_share_directory diff --git a/ign_ros2_control_demos/launch/gripper_mimic_joint_example.launch.py b/ign_ros2_control_demos/launch/gripper_mimic_joint_example.launch.py index bf12d3d..5c3b92b 100644 --- a/ign_ros2_control_demos/launch/gripper_mimic_joint_example.launch.py +++ b/ign_ros2_control_demos/launch/gripper_mimic_joint_example.launch.py @@ -75,6 +75,14 @@ def generate_launch_description(): output='screen' ) + # Bridge + bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + arguments=['/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock'], + output='screen' + ) + return LaunchDescription([ # Launch gazebo environment IncludeLaunchDescription( @@ -101,4 +109,5 @@ def generate_launch_description(): 'use_sim_time', default_value=use_sim_time, description='If true, use simulated clock'), + bridge, ])