ROS course 013: URDF Part 1
1. Conditions
This post is tested under the following conditions:
Item | Value |
---|---|
CPU | AMD Ryzen 5 2600 |
Ubuntu | 18.04 |
ROS | Melodic |
For installation, see 02 Install. The source code of all parts is upload of github, see 11 git for more detail.
2. Summary
In this post, i’ll talk about:
- concept of URDF
- create a simple URDF file and display on rviz
3. What is URDF
URDF (Unified Robot Description Format) is the standard ROS XML representation of the robot model source.
ROS’s urdf support these following tags. This is also elements which form the robot’s model. See http://wiki.ros.org/urdf/XML/ for more detail
- robot
sensor/proposals- link
- transmission
- joint
- gazebo
sensormodel_statemodel
link, join, transmission, gazebo tags are often used into urdf file. Other tags are not often used, so we ignore them. The detail of those 4 concepts is as follow/
- link : describes rigid body with an inertia, visual features, and collision properties
- join : describes the kinematics and dynamics of the joint and also specifies the safety limits of the joint.
- transmission : describes the relationship between an actuator and a joint
- gazebo : use for simulation purpose in the Gazebo simulator
To understand the 3 above concepts: link, joint, transmission, at first let’s read kawasaki’s article for a short introduction about How robots are built. In a short word, link, joint, transmission is considered as a human’s bone, joint, muscle. (Note: by contracting/relaxing muscle help human move. Similar to this, by adding mechanical motions transmission help robot move)
There’s example of baxter robot’s urdf file at baxter_description/urdf/baxter.urdf. Reading this file can help us understand how a urdf file is written in industrial robot.
4. URDF : Example 1
The procedure is as follow
4.1. Create package
cd ~/catkin_ws/src/
catkin_create_pkg vis_lecture std_msgs rospy roscpp
4.2. Create urdf
urdf file is places at the following location
src/vis_lecture/
├── CMakeLists.txt
├── launch
├── display.launch <- Download from : https://github.com/ros/urdf_tutorial/blob/master/launch/display.launch
├── package.xml
├── rviz
├── src
├── stl
├── urdf
│ ├── simple_body1.urdf <- this file
└── xacro
display.launch detail is as follow:
<launch>
<arg name="model" />
<arg name="gui" default="true" />
<arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
<param name="use_gui" value="$(arg gui)"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
</launch>
The contain of simple_body1.urdf is as follow
<?xml version="1.0"?>
<robot name="test_robot">
<link name="base_link"/>
<joint name="body_joint" type="fixed">
<parent link="base_link"/>
<child link="body_link"/>
</joint>
<link name="body_link">
<visual>
<geometry>
<box size="0.3 0.3 0.2"/>
</geometry>
<origin xyz="0 0 0" rpy="0 0 0"/>
<material name="red">
<color rgba="1.0 0.0 0.0 2.0"/>
</material>
</visual>
</link>
</robot>
4.3. Check urdf
Use the following command
# install tool if needed
sudo apt-get install liburdfdom-tools
# do check
roscd vis_lecture/urdf/
check_urdf simple_body1.urdf
The output should be á follow
robot name is: test_robot
---------- Successfully Parsed XML ---------------
root Link: base_link has 1 child(ren)
child(1): body_link
4.4. Display robot model
Run the following command to display robot model.
roscd vis_lecture/urdf/
roslaunch urdf_tutorial display.launch model:=simple_body1.urdf
Leave a comment