1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| import os
from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import ExecuteProcess from launch.substitutions import LaunchConfiguration from launch.conditions import IfCondition from launch_ros.actions import Node import xacro
def generate_launch_description():
world = os.path.join(get_package_share_directory('robot_simulation'), 'worlds', 'turtlebot3_world.world') urdf_file = os.path.join(get_package_share_directory('mobile_robot_models'), 'urdf/quimera_robot.urdf.xacro') robot = xacro.process(urdf_file) params = {'robot_description': robot}
return LaunchDescription([ ExecuteProcess( cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so', world], output='screen'), Node( package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[params] ), Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', 'robot_description', '-entity', 'cartpole'], output='screen')
])
|