mycobot_ros/mycobot_280/mycobot_280m5_gazebo_gripper/launch/gazebo.launch
2025-07-29 16:05:07 +08:00

36 lines
2 KiB
XML
Executable file

<?xml version="1.0"?>
<launch>
<!-- Gazebo options -->
<arg name="world_name" value="$(find gazebo_ros)/worlds/empty.world"/>
<arg name="gazebo_gui" default="true" doc="Start Gazebo GUI"/>
<arg name="paused" default="false" doc="Start Gazebo paused"/>
<arg name="world_pose" default="-x 0 -y 0 -z 0 -R 0 -P 0 -Y 0" doc="Pose to spawn the robot at"/>
<arg name="initial_joint_positions" default=" -J gripper_controller -0.5" doc="Initial joint configuration of the robot"/>
<!-- Start Gazebo paused to allow the controllers to pickup the initial pose -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(arg world_name)" />
</include>
<!-- Set the robot urdf on the parameter server -->
<param name="robot_description" textfile="$(find mycobot_280m5_gazebo_gripper)/config/mycobot_280m5_with_gripper_lll.urdf" />
<!-- Spawn the robot in Gazebo -->
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot $(arg world_pose) $(arg initial_joint_positions)"
respawn="false" output="screen" />
<!-- Load the controller parameters onto the parameter server -->
<rosparam file="$(find mycobot_280m5_gazebo_gripper)/config/ros_controllers.yaml" command="load" />
<!-- Spawn the Gazebo ROS controllers -->
<node name="gazebo_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller" />
<!-- Given the published joint states, publish tf for the robot links -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
<!-- Unpause Gazebo simulation after the robot model and controllers are loaded -->
<arg name="unpause" value="$(eval '' if arg('paused') else '-unpause')" />
<!-- Change the name to "gazebo_ros" or something else to avoid duplication -->
<node pkg="gazebo_ros" type="gazebo" name="gazebo_ros" args="--wait $(arg unpause)" />s
</launch>