介绍
URDF(Unified Robot Description Format)统一机器人描述格式,URDF使用XML格式描述机器人文件。URDF specs 地址: wiki.ros.org/urdf/XML
下面是一个最简单的 URDF 示例:
<?xml version="1.0"?>
<robot name="tinker">
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.18" radius="0.06"/>
</geometry>
</visual>
</link>
</robot>
URDF 文件基本组成
robot element
robot 是 URDF 中的根元素,其他标签必现被其包含。
其属性如下:
- name
- 主定义文件必须包含 name 属性. 但在 included files (被主定义文件包含的文件) 中 name 属性则是可选填的,如果填写,则必须与主定义文件保持一致
其常见的子元素有如下:
-
link defines a link with its own frame
-
joint mandatory joint frame definition
-
transmission (PR2 specific)
link element
link 元素描述了一个刚性物体的惯性矩阵,视觉特征和碰撞特性。下面是一个简单示例
<link name="my_link">
<inertial>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="1 1 1" />
</geometry>
<material name="Cyan">
<color rgba="0 1.0 1.0 1.0"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<cylinder radius="1" length="0.5"/>
</geometry>
</collision>
</link>
joint element
joint 元素描述了关节的运动学和动力学,并指定了关节的安全限制。
以下是一个关节元素的示例:
<joint name="my_joint" type="floating">
<origin xyz="0 0 1" rpy="0 0 3.1416"/>
<parent link="link1"/>
<child link="link2"/>
<calibration rising="0.0"/>
<dynamics damping="0.0" friction="0.0"/>
<limit effort="30" velocity="1.0" lower="-2.2" upper="0.7" />
<safety_controller k_velocity="10" k_position="15" soft_lower_limit="-2.0" soft_upper_limit="0.5" />
</joint>
transmission element
transmission 是URDF机器人描述模型的扩展,用于描述传动器和关节之间的关系。这允许对传动比和并联机构等概念进行建模。变速器转换作用力/流量变量,使其乘积(功率)保持恒定。多个致动器可以通过复杂的传动连接到多个关节。
以下是一个传输元件的示例:
<transmission name="simple_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="foo_joint">
<hardwareInterface>EffortJointInterface</hardwareInterface>
</joint>
<actuator name="foo_motor">
<mechanicalReduction>50</mechanicalReduction>
<hardwareInterface>EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
sensor element
sensor 元件描述了视觉传感器(即相机/光线传感器)的基本特性。
在模拟中,大型传感器会降低整体性能。根据所需的更新速率,建议将相机或光线分辨率和更新速率保持在尽可能低的水平。
proposals 这是在传感器元件中添加新型传感器的建议
以下是一个相机传感器元件的示例:
<sensor name="my_camera_sensor" update_rate="20">
<parent link="optical_frame_link_name"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<camera>
<image width="640" height="480" hfov="1.5708" format="RGB8" near="0.01" far="50.0"/>
</camera>
</sensor>
下面是激光扫描(射线)传感器元件的示例:
<sensor name="my_ray_sensor" update_rate="20">
<parent link="optical_frame_link_name"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<ray>
<horizontal samples="100" resolution="1" min_angle="-1.5708" max_angle="1.5708"/>
<vertical samples="1" resolution="1" min_angle="0" max_angle="0"/>
</ray>
</sensor>
gazebo element
The gazebo element is an extension to the URDF robot description format, used for simulation purposes in the Gazebo simulator.
For full documentation of the Gazebo element, see Using A URDF In Gazebo (for Gazebo Classic) or SDFormat extensions to URDF (the tag) (for new Gazebo).