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.
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:
<link name="link1">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://dofbot_moveit/meshes/link1.STL" />
</geometry>
<material name="">
<color rgba="0 0.627450980392157 0.235294117647059 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://dofbot_moveit/meshes/link1.STL" />
</geometry>
</collision>
</link>
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:
The
The
The
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
Sample code is as follows,
xxxxxxxxxx
<joint name="joint1" type="revolute">
<origin xyz="0 0 0.06605" rpy="-0.010805 0 0" />
<parent link="base_link" />
<child link="link1" />
<axis xyz="0 0 1" />
<limit effort="30" velocity="1.0" lower="-1.5708" upper="1.5708"/>
</joint>
The
xxxxxxxxxx
<robot name="robot_name">
<link>
...
</link>
<joint>
...
</joint>
<link>
...
</link>
<joint>
...
</joint>
<robot>
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.
xxxxxxxxxx
cd ~/ros_ws/src
catkin_create_pkg learn_urdf urdf xacro
Then return to the workspace, compile,
xxxxxxxxxx
cd ~/ros_ws
catkin_make
After compilation is completed, four new folders need to be created in the directory of the function package, namely:
In the launch folder under the learn_urdf function package, create a new file named display.launch and copy the following content into it,
x<launch>
<param name="robot_description" command="$(find xacro)/xacro --inorder $(find learn_urdf)/urdf/dofbot.urdf" />
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</launch>
Exit after saving and reopen the terminal for input.
xxxxxxxxxx
roslaunch learn_urdf display.launch
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,
xxxxxxxxxx
rviz
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].
Parse launch files,
xxxxxxxxxx
<param name="robot_description" command="$(find xacro)/xacro --inorder $(find learn_urdf)/urdf/dofbot.urdf" />
Set the urdf model to be loaded.
xxxxxxxxxx
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui"/>
Run the joint_state_publisher node to publish the joint status of the robot, and the joint can be controlled through the UI interface.
xxxxxxxxxx
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
Run the robot_state_publisher node, publish tf, and organize it into three-dimensional attitude information for publication.