RoArm-M1 Tutorial IV: URDF Model Tutorial

From Waveshare Wiki
Jump to: navigation, search

RoArm-M1 Tutorial Directory

RoArm-M1 ROS2 URDF Model Tutorial

  • This tutorial is for building the RoArm-m1 ROS2 URDF model.

The official Website About the ROS2 URDF

What is URDF

  • URDF (Unified Robot Description Format) is a file format used to specify the geometry and structure of robots in ROS.
  • In short, URDF is the file format for describing the robot structure.

How To Build RoArm-M1 URDF

If you installed ROS2 using method 1 in tutorial III, you can check URDF in the roarm_ws folder; if you installed ROS2 using method 2, you can find URDF in the RoArm-M1 folder; here I find it in roarm_ws folder.
First of all, open the folder in ubuntu, you can see there is a folder roarm_ws under the main directory, and then there are two folders under the roarm_ws/src/roarm directory: meshes and urdf.
meshes: used to save the 3D model files needed for the robot model referenced in urdf, these files are in .stl format, and according to the robot's degrees of freedom of movement, the robot model is divided into different parts.
urdf: contains a roarm.urdf file, which is used to describe the mechanical movement relationship of the relative positions of the robot model in meshes.
Here, we focus on the roarm.urdf. file.

<material> Label

<material> label refers to setting the material of the robot model, including color, patterns, etc. This label will be used in <link> label. Hence, if you do not set <material> label, or it is set with wrong parameters, all the robot models will display in red.

<material name="gray">
  <color rgba="0.8 0.8 0.8 1"/>
</material>

<material name="white">
  <color rgba="1 1 1 1"/>
</material>

Here sets the <material> label in "gray" and "white" color. "name" is the <material> label name; when setting the material for <link> label, you can input the corresponding name to the robot model.
rgba refers to the color of the selected material, "1 1 1 1" represents four channels: red, green, blue, and transparent (Alpha) channels.

<link> Label

<link> label refers to the appearance and physical property of some part of the robot model, including shape, position, and so on.

<link name="base_link">
  <visual>
    <geometry>
      <mesh filename="package://roarm/meshes/base.stl"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <material name="gray"/>
  </visual>
</link>

<link name="l1_link">
  <visual>
    <geometry>
      <mesh filename="package://roarm/meshes/L1.stl"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 -0.062"/>
    <material name="white"/>
  </visual>
</link>

"name" is the name of the <link> label, defining some part of the robot model.
"visual" is the visual property of the <link> label such as shape and color.
Input the corresponding address of ".stl" file of this part in "mesh filename". If the file address is not adopted, you can use other shape name (such as cylinder) + shape parameter to define this part. For example:

<geometry>
   <cylinder length="0.6" radius="0.2"/>
</geometry>  

Denote that this robot part is a cylinder with length 0.6 and cross-section radius 0.2.
"origin" refers to the coordinate system attribute of the <link> label, "rpy" is the rotation of roll, pitch, and yaw axis. Angles here are in radians; xyz indicates the position of the coordinate system corresponding to this part in meters.
"material" indicates using the corresponding material.

<joint> Label

<joint> label refers to the joints to connect to two specific link parts. It mainly describes the kinematic and dynamic properties of the robot's joints

<joint name="base_to_L1" type="revolute">
  <axis xyz="0 0 1"/>
  <limit effort="1000.0" lower="-3.14" velocity="0.5"/>
  <parent link="base_link"/>
  <child link="l1_link"/>
  <origin xyz="0 0 0.062"/>
</joint>

"name" is the joint name.
"type" is the joint type, "revolute" is the rotation joint (Refer to the following table for other joint types)

Joint Type Description
continuous Rotate joints, rotate continuously around a single axis (e.g. wheels)
revolute Rotate joints, similar to "continuous", rotates with limited angles
prismatic Slide joints, the joint moves along an axis with limited position
planar Allows translation or rotation in the orthogonal direction of the plane
floating Floates joints, allow for translation and rotation
fixed Fixed joints, fix no-movement joints

"axis xyz" is the rotation axis. "0" indicates the no-rotation axis, and "1" indicates the rotation axis. Here it indicates the rotation axis is z axis.
"limit" refers to the rotation with limited angles.
-3.14~3.14 is -180~180° for the radian system, the rest of the power and speed parameters are unimportant.
"parent link" refers to the parent relationship between the movement of two link parts.
"child link" refers to the child relationship between the movement of two link parts.
"origin xyz" refers to the corresponding coordinates of this joint, unit: m.

Summary

The above only describes two materials, two models, and one joint. The rest of the sections are defined in the same way and will not be repeated here.