2022-11-16 22:56:34 +08:00
|
|
|
<launch>
|
|
|
|
<arg name="wname" default="earth"/>
|
|
|
|
<arg name="rname" default="z1"/>
|
|
|
|
<arg name="robot_path" value="(find $(arg rname)_description)"/>
|
|
|
|
<arg name="dollar" value="$"/>
|
|
|
|
|
|
|
|
<arg name="paused" default="true"/>
|
|
|
|
<arg name="use_sim_time" default="true"/>
|
|
|
|
<arg name="gui" default="true"/>
|
|
|
|
<arg name="headless" default="false"/>
|
|
|
|
<arg name="debug" default="false"/>
|
|
|
|
<!-- Debug mode will hung up the robot, use "true" or "false" to switch it. -->
|
|
|
|
<arg name="user_debug" default="false"/>
|
|
|
|
<arg name="UnitreeGripperYN" default="true"/>
|
|
|
|
|
|
|
|
<include file="$(find gazebo_ros)/launch/empty_world.launch">
|
2022-12-21 16:56:32 +08:00
|
|
|
<arg name="world_name" value="$(find unitree_gazebo)/worlds/$(arg wname).world"/>
|
2022-11-16 22:56:34 +08:00
|
|
|
<arg name="debug" value="$(arg debug)"/>
|
|
|
|
<arg name="gui" value="$(arg gui)"/>
|
|
|
|
<arg name="paused" value="$(arg paused)"/>
|
|
|
|
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
|
|
|
|
<arg name="headless" value="$(arg headless)"/>
|
|
|
|
</include>
|
|
|
|
|
|
|
|
<!-- Load the URDF into the ROS Parameter Server -->
|
|
|
|
<param name="robot_description"
|
|
|
|
command="$(find xacro)/xacro --inorder '$(arg dollar)$(arg robot_path)/xacro/robot.xacro'
|
|
|
|
UnitreeGripper:=$(arg UnitreeGripperYN)"/>
|
|
|
|
|
|
|
|
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
|
|
|
|
<!-- Set trunk and joint positions at startup -->
|
|
|
|
<node pkg="gazebo_ros" type="spawn_model" name="urdf_spawner" respawn="false" output="screen"
|
|
|
|
args="-urdf -z 0.0 -model $(arg rname)_gazebo -param robot_description -unpause"/>
|
|
|
|
|
|
|
|
<!-- Load joint controller configurations from YAML file to parameter server -->
|
|
|
|
<rosparam file="$(arg dollar)$(arg robot_path)/config/robot_control.yaml" command="load"/>
|
|
|
|
|
|
|
|
<!-- load the controllers -->
|
|
|
|
<group unless="$(arg UnitreeGripperYN)">
|
|
|
|
<node pkg="controller_manager" type="spawner" name="controller_spawner" respawn="false"
|
|
|
|
output="screen" ns="/$(arg rname)_gazebo" args="joint_state_controller
|
|
|
|
Joint01_controller Joint02_controller Joint03_controller
|
|
|
|
Joint04_controller Joint05_controller Joint06_controller"/>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<group if="$(arg UnitreeGripperYN)">
|
|
|
|
<node pkg="controller_manager" type="spawner" name="controller_spawner" respawn="false"
|
|
|
|
output="screen" ns="/$(arg rname)_gazebo" args="joint_state_controller
|
|
|
|
Joint01_controller Joint02_controller Joint03_controller
|
|
|
|
Joint04_controller Joint05_controller Joint06_controller
|
|
|
|
gripper_controller"/>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<!-- convert joint states to TF transforms for rviz, etc -->
|
|
|
|
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"
|
|
|
|
respawn="false" output="screen">
|
|
|
|
<remap from="/joint_states" to="/$(arg rname)_gazebo/joint_states"/>
|
|
|
|
</node>
|
|
|
|
|
|
|
|
</launch>
|