20.urdf model introduction

URDF is the robot description format in ROS. Its full name is Unified Robot Description Format, which describes the robot's appearance, physical attributes, joint types, etc. URDF files are written in XML language. Let's first understand the commonly used XML tags in URDF files.

20.1 tag

20.1.1 Introduction

In the URDF descriptive language, links are used to describe physical properties. It can be detailed as a human arm, which represents a whole body and has the following tags:

Each link will be regarded as a coordinate system. The usage example is as follows:

The name attribute in the tag is required, describes the current link name, and is unique. In the sample code you can see the following sets of tags:

20.2 tag

20.2.1 Introduction

Describe the relationship between two joints. Movement position and speed limits. Kinematic and dynamic properties. It can be imagined as the joints of the human body, which include the following types:

A pair of tags also have the following sub-tags:

Sample code is as follows,

20.3 tag

The tag is the top tag of the complete robot model. It is placed at the head and tail ends. It contains and . The name of the robot can be set in the tag. The usage is as follows:

20.4 Create urdf function package

Generally, urdf files will be placed independently in a function package. Create the learn_urdf function package under src of the original workspace and enter it in the terminal.

Then return to the workspace, compile,

After compilation is completed, four new folders need to be created in the directory of the function package, namely:

20.5 Write launch to start urdf

In the launch folder under the learn_urdf function package, create a new file named display.launch and copy the following content into it,

Exit after saving and reopen the terminal for input.

image-20231027104402651

The GUI interface on the right can control the movement of the robotic arm through the slider. Now open rviz to display the robot arm, terminal input,

image-20231027104631306

As shown in the picture above, set [Fixed Frame] to base_link, then click [Add], select [By display type], select [RobotModel], and finally click [OK].

image-20231027104857854

Parse launch files,

Set the urdf model to be loaded.

Run the joint_state_publisher node to publish the joint status of the robot, and the joint can be controlled through the UI interface.

Run the robot_state_publisher node, publish tf, and organize it into three-dimensional attitude information for publication.