1:编写xacro文件
2:把xacro文件转换为urdf文件
3:使用gazebo建立sdf文件fine,也就是ros1里面的world文件,现在后缀是sdf文件了
4:把urdf文件转换为sdf文件good
5:把修改后的good.sdf文件稍微修改后插入fine.sdf文件中
6:使用launch文件加载sdf文件
这个文件只用于加载模型
<launch>
<group><let name="robot_description" value="$(command 'xacro $(find-pkg-share gazebo_pkg)/urdf/total.xacro')"/><node pkg="rviz2" exec="rviz2" name="rviz2" output="screen"/><node pkg="robot_state_publisher" exec="robot_state_publisher" name="robot_state_publisher"><param name="robot_description" value="$(var robot_description)" type="str"/></node><node exec="parameter_bridge" pkg="ros_gz_bridge"/><node name="joint_state_publisher" exec="joint_state_publisher" pkg="joint_state_publisher"/><include file="$(find-pkg-share ros_gz_sim)/launch/gz_sim.launch.py"><arg name="gz_args" value="-v 4 -r /home/actorsun/test/1.sdf"/></include><!--<node pkg="ros_gz_bridge" exec="parameter_bridge" args="-urdf -model half -param robot_description"/>
-->
</group>
</launch>