Welcome to RDK X5 Robot repository
7. URDF Model
7. URDF model
7. URDF model7.1. Program function description7.2. Program code reference path7.3, Program startup7.4, URDF introduction7.4.1, link7.4.2, joints
7.1. Program function description
After running the relevant program on the virtual machine, the URDF model file of the car can be displayed in rviz. The car side also carries the relevant program, but because there is no visual interface, rviz will not be started during operation, but the tf transformation of the coordinate system of the chassis and sensor will still be released for subsequent functions.
7.2. Program code reference path
The virtual machine The source code of this function is located at,
xxxxxxxxxx/home/yahboom/yahboomcar_ws/src/yahboomcar_rviz/launch/yahboomcar_urdf_launch.pyAmong them, the path of the URDF model file is,
xxxxxxxxxx/home/yahboom/yahboomcar_ws/src/yahboomcar_rviz/urdf/yahboomcar.urdf
S After SH connects to the car, the location of the relevant source code is,
xxxxxxxxxx/home/sunrise/yahboomcar_ws/src/yahboomcar_description/launch/description_launch.pyAmong them, the path of the URDF model file is,
xxxxxxxxxx/home/sunrise/yahboomcar_ws/src/yahboomcar_description/urdf/yahboomcar.urdf
7.3, Program startup
In the virtual machine terminal, enter,
xxxxxxxxxxros2 launch yahboomcar_rviz yahboomcar_urdf_launch.py
You can view the TF tree, virtual machine terminal input,
xxxxxxxxxxros2 run tf2_tools view_framesA frame.pdf file will be generated in the terminal directory, and then we open it with the following command,
xxxxxxxxxxevince frames.pdf
7.4, URDF introduction
URDF, the full name is Unified Robot Description Format, translated into Chinese as Unified Robot Description Format is a robot model file described in XML format, similar to D-H parameters.
xxxxxxxxxx <robot name="yahboomcar"></robot>The first line is a required XML field, describing the XML version information.
The second line describes the current robot name; all information about the current robot is contained in the [robot] tag.
Components:
Link, connecting rod, can be imagined as a human arm
Joint, joint, can be imagined as a human elbow joint
Relationship between link and joint: two links are connected by joints, imagine that the arm has a small arm (link) and a large arm (link) connected by an elbow joint (joint).
7.4.1, link
1), Introduction
In the URDF descriptive language, link is used to describe physical properties,
Describe visual display,
tag. Describe collision properties,
tag. Describes physical inertia, the
tag is not commonly used.
Links can also describe the link size (size)\color (color)\shape (shape)\inertial matrix (inertial matrix)\collision parameters (collision
properties), etc. Each Link will become a coordinate system.
Sample code (yahboomcar.urdf)
xxxxxxxxxx<linkname="base_link"><inertial><originxyz="0.00747327885898614 -0.000703137401396085 0.00844632750789007"rpy="0 0 0" /><massvalue="0.472828691870721" /><inertiaixx="0.00023735992797554"ixy="1.96687462104139E-07"ixz="4.09403791310172E-05"iyy="0.000480258948998206" iyz="2.77544074265144E-07" izz="0.000585619745886075" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://yahboomcar_rviz/meshes/base_link.STL" /> </geometry> <material name=""> <color rgba="1 1 1 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://yahboomcar_rviz/meshes/base_link.STL" /></geometry></collision></link>Tag introduction
origin
Describes the pose information; the xyz attribute describes the coordinate position in the environment, and the rpy attribute describes its own posture.
mess
Describes the quality of the link.
inertia
Inertial reference system, due to the symmetry of the rotational inertia matrix, only 6 upper triangular elements ixx, ixy, ixz, iyy, iyz, izz are required as attributes.
geometry
The tag describes the shape; the main function of the mesh attribute is to load the texture file, and the filename attribute is the file address of the texture path.
xxxxxxxxxx<box size="1 2 3"/> #box box, the length, width and height of the box are described by the size attribute.<cylinder length="1.6" radius="0.5"/> #cylinder is cylindrical, the `length` attribute is used to describe the height of the cylinder, and the `radius` attribute is used to describe the radius of the cylinder.<sphere radius="1"/> #sphere is spherical, and the `radius` attribute is used to describe the radius of the sphere.material
The tag describes the material; the name attribute is a required item, can be empty, and can be repeated. The rgba attribute in the [color] tag is used to describe red, green, blue, and transparency, separated by spaces. The color range is [0-1].
7.4.2, joints
1), Introduction
Describes the relationship between two joints, movement position and speed restrictions, kinematic and dynamic properties.
Joint types:
fixed: fixed joint. No movement is allowed, it acts as a connection.
continuous: revolute joint. It can rotate continuously, without rotation angle restrictions.
revolute: revolute joint. Similar to continuous, with rotation angle restrictions.
prismatic: sliding joint. Moves along a certain axis with position restrictions.
floating: floating joint. Has six degrees of freedom, 3T3R.
planar: planar joint. Allows translation or rotation above the plane orthogonal to the plane.
2), Sample code (yahboomcar.urdf)
x<jointname="left_front_joint"type="continuous"><originxyz="0.06 0.08361 -0.03295"rpy="0 0 0" /><parentlink="base_link" /><childlink="left_front_wheel" /><axisxyz="0 1 0" /><limitlower="0"upper="0"effort="0"velocity="0" /></joint>
In the [joint] tag, the name attribute is a required item, describing the name of the joint and is unique.
In the [joint] tag, fill in the type attribute for the six major joint types.
Tag introduction
origin
Subtag, refers to the relative position of the rotation joint in the parent coordinate system.
parent, child
The parent and child subtags represent two links to be connected; parent is a reference object, and child rotates around the parent.
axis
The subtag indicates which axis (xyz) the link corresponding to the child rotates around and the amount of rotation around the fixed axis.
limit
The subtag is mainly used to limit the child. The lower and upper attributes limit the range of rotation, the effort attribute limits the force range during the rotation process. (positive and negative value, in Newton or N), the velocity attribute limits the speed of rotation, in meters/second or m/s.
mimic
Describes the relationship between this joint and the existing joints.
safety_controller
Describes the safety controller parameters. Protects the movement of the robot joints.