官术网_书友最值得收藏!

Explaining the URDF file

When we check the code, we can add a <robot> tag at the top of the description:

<?xml version="1.0"?>
<robot name="pan_tilt">

The <robot> tag defines the name of the robot that we are going to create. Here, we named the robot pan_tilt.

If we check the sections after the <robot> tag definition, we can see link and joint definitions of the pan and tilt mechanism:

  <link name="base_link">
    <visual>
      <geometry>
      <cylinder length="0.01" radius="0.2"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="yellow">
        <color rgba="1 1 0 1"/>
      </material>
    </visual>
  </link>

The preceding code snippet is the base_link definition of the pan and tilt mechanism. The <visual> tag can describe the visual appearance of the link, which is shown on the robot simulation. We can define the link geometry (cylinder, box, sphere, or mesh) and the material (color and texture) of the link using this tag:

  <joint name="pan_joint" type="revolute">
    <parent link="base_link"/>
    <child link="pan_link"/>
    <origin xyz="0 0 0.1"/>
    <axis xyz="0 0 1" />
  </joint>

In the preceding code snippet, we define a joint with a unique name and its joint type. The joint type we used here is revolute and the parent link and child link are base_link and the pan_link respectively. The joint origin is also specified inside this tag.

Save the preceding URDF code as pan_tilt.urdf and check whether the urdf contains errors using the following command:

$ check_urdf pan_tilt.urdf

The check_urdf command will parse urdf and show an error, if any. If everything is OK, it will show an output as follows:

robot name is: pan_tilt
---------- Successfully Parsed XML ---------------
root Link: base_link has 1 child(ren)
 child(1): pan_link
 child(1): tilt_link

If we want to view the structure of the robot links and joints graphically, we can use a command tool called urdf_to_graphiz:

$ urdf_to_graphiz pan_tilt.urdf

This command will generate two files: pan_tilt.gv and pan_tilt.pdf. We can view the structure of this robot using following command:

$ evince pan_tilt.pdf

We will get the following output:

Figure 5 : Graph of joint and links in pan and tilt mechanism

主站蜘蛛池模板: 凤台县| 桃园县| 揭西县| 治多县| 横山县| 怀化市| 大悟县| 延吉市| 兰溪市| 三河市| 肇州县| 彰化市| 灌南县| 延边| 安西县| 布拖县| 桦川县| 河东区| 延吉市| 灵武市| 隆回县| 修文县| 师宗县| 民和| 兴和县| 四川省| 伊吾县| 台中县| 神木县| 聂拉木县| 辽源市| 通化市| 专栏| 石柱| 抚顺县| 宣恩县| 汤阴县| 大埔县| 温宿县| 蓝田县| 开封县|