一、创建工作空间
# 创建工作空间
$ mkdir -p catkin_ws/src
$ cd catkin_ws/src
$ catkin_init_workspace
# 编译工作空间
$ cd catkin_ws
$ catkin_make
#构建install文件夹
$ catkin_make install
二、创建功能包
# 创建功能包模板
$ catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
# 在工作空间中的src中创建功能包
$ cd /catkin_ws/src
$ catkin_create_pkg mrobot_description urdf xacro
功能包中包含urdf、meshes、launch、config文件夹:
urdf:用于存放机器人模型的URDF或xacro文件。
meshes:用于放置URDF中引用的模型渲染文件。
launch:用于存放相关启动文件。
config:用于存放rviz的配置文件。
三、在urdf文件夹中建立一个mrobot_chassis.urdf的文档。
<?xml version="1.0"?>
<robot name="mrobot_chassis">
<!--link0: the propety of base link-->
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<cylinder length="0.05" radius="0.13"/>
</geometry>
<matrial name="yellow">
<color rgba="1 0.4 0 1"/>
</matrial>
</visual>
</link>
<!--joint1: base_left_motor_joint is the joint of the base_link and left_motor.The connection is fixed.-->
<joint name="base_left_motor_joint" type="fixed">
<origin xyz="-0.055 0.075 0" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="left_motor"/>
</joint>
<!--link1: the property of the left motor-->
<link name="left_motor">
<visual>