Let's move on to the ROS Learning series-using URDF to create a robot model in Rviz, one of the 3D observations link uses to continue creating a double-decker trolley with four wheels to turn.
a joint that can be rotated
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0"? ><robot name= "SP1s" > <link name= "Base_link" > <visual> <geometr y> <box size= "0.27.003"/> </geometry> <material name= "White" > <color Rgba= "1 1 1.5"/> </material> </visual> </link> <link name= "Front_left" > <visu al> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geometry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </visual> < ;/link> <joint name= "Base_to_front_left" type= "<span style=" color: #FF0000; " ><strong>continuous</strong></span> "> <origin rpy=" 1.57075 0 0 "xyz=" 0.06 0.064-0.011 "/ > <parent link= "base_link"/> <child link= "Front_left"/> <axis xyz= "0 0 1"/> </joint& gt;</robot></span&Gt
1. Change the type of joint to "continuous" so that front_left relative base_link is a rotating device .
2. The position of rotation is defined by origin, which defines the new origin of the tyer_front_left at the same time, and its origin is the default of the Base_link origin.
XYZ is the offset from the relative Parant Base_link origin, which moves the wheel to the left front. which
z = -0.011m = 6.8cm/2- 4.5cm, ensure that the wheels are on the ground
y = 0.064m = 15cm/2-2.5CM/2 (wheel thickness) + offset
The pry is the angle (radian system) that rotates at the center of the x y Z axis, respectively, 1.57075 is 90 degrees. Rotate the 90-degree wheel around the x-axis to get it up.
3. Axis re-defines the direction of the rotation axis at the origin, it is a vector, only indicates the direction, they must meet X * x + y * y + z * z = 1 The origin Z axis has been rotated 90 degrees into the horizontal direction, so here the definition of z-axis direction of rotation
two repeat add four wheels
Three other wheels only the origin positive and negative values are adjusted
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0"? ><robot name= "SP1s" > <link name= "Base_link" > <visual> <geometr y> <box size= "0.27.003"/> </geometry> <material name= "White" > <color Rgba= "1 1 1.5"/> </material> </visual> </link> <link name= "Tyer_front_left" > < ;visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geometry& Gt <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </visual> </li nk> <link name= "Tyer_front_right" > <visual> <geometry> <cylinder length= ". 025" Radi us= "0.034" ></cylinder> </geometry> <material name= "Yellow" > <color rgba= "1 1 0 1 "/> </material> </visual> </link> <link name=" Tyer_back_left "&Gt <visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geomet ry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </vis ual> </link> <link name= "Tyer_back_right" > <visual> <geometry> <cylinder L Ength= ". 025" radius= "0.034" ></cylinder> </geometry> <material name= "Yellow" > < ; color rgba= "1 1 0 1"/> </material> </visual> </link> <joint name= "base_to_front_l EFT "type=" continuous "> <origin rpy=" 1.57075 0 0 "xyz=" 0.06 0.064-0.011 "/> <parent link=" Base_link " /> <child link= "Tyer_front_left"/> <axis xyz= "0 0 1"/> </joint> <joint name= "Base_to_f Ront_right "type=" continuous "> <origin rpy=" 1.57075 0 0 "xyz=" 0.06-0.064-0.011 "/> <parent link=" ba Se_link "/><child link= "Tyer_front_right"/> <axis xyz= "0 0 1"/> </joint> <joint name= "Base_to_back_left "type=" continuous "> <origin rpy=" 1.57075 0 0 "xyz=" -0.06 0.064-0.011 "/> <parent link=" Base_link "/& Gt <child link= "Tyer_back_left"/> <axis xyz= "0 0 1"/> </joint> <joint name= "Base_to_back_right" type= "continuous" > <origin rpy= "1.57075 0 0" xyz= " -0.06-0.064-0.011"/> <parent link= "Base_link"/& Gt <child link= "Tyer_back_right"/> <axis xyz= "0 0 1"/> </joint></robot></span>
Three add four pillars
The four corners on the upper and lower floors are pillars of 3cm high. Add the following to add a column to the left front, based on the URDF above.
<span style= "FONT-SIZE:18PX;" > <link name= "Pillar_front_left" > <visual> <geometry> <cylinder length= " . "Radius=" 0.0025 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> < Material name= "Silver" > <color rgba= ". 1"/> </material> </visual> </link> <joint name= "base_to_pillar_front_left" type= "fixed" > <origin xyz= "0.13 0.07 0.0015 "/> <parent link=" Base_link "/> <child link=" Pillar_front_left "/> </joint></span>
1. The column does not rotate, so the joint type is fixed
2. Joint inside definition changed the origin point of the pillar to xyz= "0.13 0.07 0.0015" is relative Base_link
3. Link also defines the origin as xyz= "0 0 0.015", here is only the offset on the display, it is relative to the origin defined in the joint, but does not change the physical origin defined in the joint .
4. Next, add three columns, as described in the last paragraph of the URDF definition
Four adding the upper layer
The upper layer, like Base_link, is connected between them by a fixed joint. Offset 3cm in the Z-axis direction.
<link name= "Top_link" > <visual> <geometry> <box size= "0.27. 003"/> </geometry> <material name= "White" > <color rgba= "1 1 1.5"/> </material> </visual> </link> <joint name= "base_to_top" type= "fixed" > <origin xyz= "0 0 0.03 "/> <parent link=" Base_link "/> <child link= " Top_link "/> </joint>
Five complete URDF.
<?xml version= "1.0"? ><robot name= "SP1s" > <link name= "Base_link" > <visual> <geometry> ; <box size= "0.27.003"/> </geometry> <material name= "White" > <color rgba= "1 1 1 .5 "/> </material> </visual> </link> <link name=" Tyer_front_left "> <visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geometry> < Material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </visual> </LINK&G T <link name= "Tyer_front_right" > <visual> <geometry> <cylinder length= ". 025" radius= "0.03 4 "></cylinder> </geometry> <material name=" Yellow "> <color rgba=" 1 1 0 1 "/> ; </material> </visual> </link> <link name= "Tyer_back_left" > <visual> <geo MeTry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geometry> <material Name = "Yellow" > <color rgba= "1 1 0 1"/> </material> </visual> </link> < Link name= "tyer_back_right" > <visual> <geometry> <cylinder length= ". 025" radius= "0.034" &G t;</cylinder> </geometry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </visual> </link> <joint name= "Base_to_front_left" type= "continuous" > <origin rpy= "1.57075 0 0" xyz= "0.06 0.064-0.011"/> <parent link= "Base_link"/> <child link= "Tyer _front_left "/> <axis xyz=" 0 0 1 "/> </joint> <joint name=" base_to_front_right "type=" continuous " > <origin rpy= "1.57075 0 0" xyz= "0.06-0.064-0.011"/> <parent link= "Base_link"/> <child li nk= "Tyer_front_right"/> <axis xyz= "0 0 1"/> </joint> <joint name= "Base_to_back_left" type= "continuous" > <origin rpy= "1.5 7075 0 0 "xyz=" -0.06 0.064-0.011 "/> <parent link=" Base_link "/> <child link=" Tyer_back_left "/> <axis xyz= "0 0 1"/> </joint> <joint name= "base_to_back_right" type= "continuous" > <origin RP y= "1.57075 0 0" xyz= " -0.06-0.064-0.011"/> <parent link= "Base_link"/> <child link= "Tyer_back_right" /> <axis xyz= "0 0 1"/> </joint> <link name= "Pillar_front_left" > <visual> <g Eometry> <cylinder length= "." Radius= "0.0025" ></cylinder> </geometry> <origin XY z= "0 0 0.015"/> <material name= "Silver" > <color rgba= ".". 1 "/> </materi al> </visual> </link> <link name= "Pillar_front_right" > <visual> <geometry> <cylinDer Length= ". radius=" 0.0025 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> & Lt;material name= "Silver" > <color rgba= ". 1"/> </material> </visual> </link> <link name= "Pillar_back_left" > <visual> <geometry> <cylinder length= ". 03 "Radius=" 0.0025 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> <material nam E= "Silver" > <color rgba= ". 1"/> </material> </visual> </link> <link name= "Pillar_back_right" > <visual> <geometry> <cylinder length= "." Radius= "0.00 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> <material name=" Silver "> <color rgba= ". 1"/> </material> </visual> </link> <joint Name = "base_to_pillar_front_lEFT "type=" fixed "> <origin xyz=" 0.13 0.07 0.0015 "/> <parent link=" Base_link "/> <child link=" p Illar_front_left "/> </joint> <joint name=" base_to_pillar_front_right "type=" fixed "> <origin xyz="- 0.13 0.07 0.0015 "/> <parent link=" Base_link "/> <child link=" Pillar_front_right "/> </joint> <joint name= "Base_to_pillar_back_left" type= "fixed" > <origin xyz= "0.13-0.07 0.0015"/> <parent link = "Base_link"/> <child link= "Pillar_back_left"/> </joint> <joint name= "Base_to_pillar_back_right" t ype= "fixed" > <origin xyz= " -0.13-0.07 0.0015"/> <parent link= "Base_link"/> <child link= "Pilla R_back_right "/> </joint> <link name=" Top_link "> <visual> <geometry> <box si Ze= "0.27 003"/> </geometry> <material name= "White" > <color rgba= "1 1 1.5"/> </material> </visual> </link> <joint name= "base_to_top" type= "fixed" > <origin xyz= "0 0 0.03"/> <pare NT link= "Base_link"/> <child link= "Top_link"/> </joint></robot>
ROS Learning Series-using URDF to create a robot model in Rviz 3D observation one joint use