from launch.launch_description import LaunchDescription from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument from launch.substitutions import PathJoinSubstitution, LaunchConfiguration from launch_ros.substitutions import FindPackageShare from launch_ros.actions import Node from launch.launch_description_sources import PythonLaunchDescriptionSource def generate_launch_description(): # Launch arguments launch_args = [] launch_args.append(DeclareLaunchArgument( name="robot_name", default_value="rasms_description", description="Set robot name." )) # Launch Gazebo gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([ FindPackageShare("gazebo_ros"), "launch", "gazebo.launch.py" ]) ) ) spawn_entity = Node( package="gazebo_ros", executable="spawn_entity.py", arguments=[ "-topic", "robot_description", "-entity", LaunchConfiguration("robot_name") ], output="screen" ) return LaunchDescription( launch_args + [ gazebo, spawn_entity ])