RoArm-M2-S ROS2 URDF Model Tutorial

From Waveshare Wiki
Jump to: navigation, search

RoArm-M2-S ROS2 URDF Model Tutorial

  • This tutorial is for building the RoArm-M2-S 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 View RoArm-M2-S URDF

The RoArm-M2-S EoAT has two types. To view the "claw" configuration, navigate to the roarm_ws_em0 folder. For the "wrist" configuration, navigate to the roarm_ws_em1 folder. This tutorial primarily focuses on viewing the default "claw" configuration of the RoArm-M2-S ROS2 URDF generation.

Firstly, in Ubuntu, open the folder and locate the roarm_ws_em0 folder in the main directory. Inside the roarm_ws_em0/src/roarm directory, you'll find two folders: meshes and urdf.

  • Meshes: This directory stores 3D model files (.stl format) required for referencing in the URDF robot model. The robot model is segmented into different parts based on its degrees of freedom.
  • URDF: It contains a roarm.urdf file that describes the structural motion relationships of the robot model relative to the meshes.

We will focus on the content within the roarm.urdf file for this explanation.

Define Material

The <material> tag is mainly used to set the material of a certain part of the robot model, including the color, texture, and so on. This tag will be referenced on the <link> tag.
If the <material> tag is not set or is set incorrectly, all robot models will end up displaying in red color.

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

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

Here, colors are set for materials named "gray" and "white". The name is the name attribute of the <material> tag. When assigning a material to a robot model using the <link> tag, inputting the corresponding name attribute will assign the respective material to the robot model.

RGBA is used to define the color of the material, with the following four parameters representing the four channels: red, green, blue, and alpha (transparency) channels.

Define Model

The <link> tag is primarily used to describe the appearance and physical attributes of a part of the robot model, including shape, position, etc.

<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 attribute of the <link> tag, defining the name of a part of the robot model.
visual is the visual attribute of the <link> tag, i.e. the shape, color, etc. that this part of the robot model is rendered in.
The mesh filename input is the address of the .stl file corresponding to this part, or if not in the form of a file address, you can use the name of another shape (e.g., cylinder) + the parameters of the shape to define the part. For example:

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

Indicates that this robot part is a cylinder with length 0.6 and cross-section radius 0.2.
origin is the coordinate system attribute of the <link> tag, where rpy indicates the rotation of the roll, pitch, and yaw axes, where the angles are in radians, and xyz indicates the corresponding coordinate system position of the part, in meters.
material indicates the material with the corresponding name.

Define Joints

The <joint> tag is used to connect the joints of two specific LINK sections, mainly to describe 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 name of this joint.
"type" is the joint type, and revolute is the rotation joint.
"continuous": Rotary joints that can rotate infinitely about a single axis (e.g. wheels).
"revolute": Rotary joints, similar to continuous, but with angular limits of rotation.
"prismatic": Sliding joints, moving along a certain axis, with positional limits.
"planar": Planar joint, allows translation or rotation in the orthogonal direction of the plane.
"floating": floating joints, allowing translation and rotation in the orthogonal direction of the plane.
"fixed": Fixed joints, special joints that do not allow movement.
"axis xyz" is the rotation axis, the value 0 is the non-rotating axis, and the value 1 is the rotating axis.
"limit" is used to define the angle limit of rotation, -3.14~3.14 is -180~180° in radians, and the rest of the power and speed parameters are not important.
"parent link", is used to define the parent of the motion relation.
"child link", is used to define the children of the motion relation.
"origin xyz", is used to define the position of this joint, the unit is in meters.

Summary

Only two materials, two models, and one joint are described above, and the rest of the definition methods are the same, so I won't go into details here.

RoArm-M2-S Tutorial Directory

RoArm-M2-S User Tutorial

RoArm-M2-S ROS2 Basic Tutorial