ROS (7) URDF build their own robot model
1. Build your own model and display it in the Rviz, which requires three files.
(1) URDF file: This file is a robot shape description file, mainly including link and joint, need to be written in strict format. Specific reference http://wiki.ros.org/urdf/Tutorials/
(2) Rviz file: Used to configure Rviz related parameters
(3) Launch files: Starting Rviz and URDF
2. Specific implementation:
. Rviz: Direct replication Urdf_tutorials Urdf.rviz
. Launch: Copy display.launch in Urdf_tutorials
Code Modifications:
<param name= "Robot_description" textfile= "$ (find pkg_name)/urdf/xxx.urdf"/>
<node name= "Rviz" type = "Rviz" args= "-D $ (Find okg_name)"/xxx.rviz "required=" true "/>
. URDF check URDF file for grammatical problems: URDF directory CHECK_URDF XXX.URDF
3.Xacro:
In the Urdf file, the size parameters and location of each part are embedded, and the Xacro can be written for different sizes of the same model. Xacro can be interpreted as a macro language (macro language) designed for URDF extensibility and configuration. With a xacro, you can
Write URDF files like programming.
First we look at the variable definition of the Xacro file:
<xacro:macro name= "pr2_arm" params= "suffix parent reflect" >
<pr2_upperarm suffix= "${suffix}" reflect= "$ {reflect} "parent=" ${parent} "/>
<pr2_forearm suffix=" ${suffix} "reflect=" ${reflect} "parent=" Elbow_flex_ ${suffix} "/>
</xacro:macro>
<xacro:pr2_arm suffix=" left "reflect=" 1 "parent=" Torso "/>
<xacro:pr2_arm suffix= "Right" reflect= "-1" parent= "torso"/>
<xacro:property name= "The_radius" value= "2.1"/> <xacro:property name= "
the_length" value= "4.5"/>
<geometry type= "cylinder" radius= "${the_radius}" length= "${the_length}"/>
Copy the Xacrodisplay.launch in the urdf_tutorials to modify the model address in launch after the edit is complete