ROS Learning Series-using URDF to create a robot model in Rviz 3D observation of the second joint using _ros

Source: Internet
Author: User

We're going to go ahead. ROS Learning Series--using URDF to create a robot model in Rviz one of the 3D observation link uses continue to create a two-wheeled trolley with four wheels to rotate. A set of joint that can rotate

<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0"?> <robot name= "SP1s" > <link name= "Base_link" > <visual> <geo metry> <box size= "0.27 003"/> </geometry> <material name= "White" > & Lt;color rgba= "1 1 1.5"/> </material> </visual> </link> <link name= "Front_left"
    ; <visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geo metry> <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 "/> </j OinT> </robot></span>
 

1. Change the joint type to "continuous" so front_left relative base_link is a rotating device

2. The position of rotation is defined by the origin, which defines the new origin of the Tyer_front_left, which is the origin of the Base_link before its original point.

XYZ is an 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, make sure the wheels are on the ground

y = 0.064m = 15cm/2-2.5CM/2 (wheel thickness) + offset

Pry is the angle (radians) that rotates at the center of the x y Z axis 1.57075 is 90 degrees. Rotate 90 degrees around the x axis and the wheel is upright.

3. Axis redefine the direction of the rotation axis at the origin, which is a vector, indicating only the direction, they must satisfy the x * x + y * y + z * z = 1 The origin Z axis has been rotated 90 degrees to the horizontal direction, so here the z axis is defined as the direction of rotation.




Two repeat add four wheels

The other three wheels have only origin positive and negative values adjustment

<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0"?> <robot name= "SP1s" > <link name= "Base_link" > <visual> <geo metry> <box size= "0.27 003"/> </geometry> <material name= "White" > & Lt;color rgba= "1 1 1.5"/> </material> </visual> </link> <link name= "Tyer_front_lef
      T "> <visual> <geometry> <cylinder length=". 025 "radius=" 0.034 "></cylinder>  
    </geometry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material>
       </visual> </link> <link name= "Tyer_front_right" > <visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geometry> <material name= "Yello
 W "> <color rgba=" 1 1 0 1 "/> </material> </visual> </link> 
  <link name= "Tyer_back_left" > <visual> <geometry> <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" ></cylinder> </geomet ry> <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 RP y= "1.57075 0 0" xyz= "0.06-0.064-0.011 "/> <parent link=" Base_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 "/> <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 "/> <child link=" Tyer_back_r ight "/> <axis xyz=" 0 0 1 "/> </joint> </robot> </span>


Three add four Pillars

The four corners of the upper and lower layers are high 3cm pillars. Add the following content to the URDF above to add a pillar to the left front.

<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 pillar does not rotate, so the type of joint is fixed

2. Joint inside the definition changed the origin of the column for xyz= "0.13 0.07 0.0015" is relatively base_link

3. Link also defines the origin as xyz= "0 0 0.015", here is only the offset on the display, which is relative to the origin defined in the joint, but does not change the physical origin defined in joint.

4. Then repeat the addition of three pillars, as detailed in the last paragraph of the URDF definition


Four Add top

The upper layer, like the Base_link, is connected by a fixed joint. Offsets 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> <geometr y> <box size= "0.27 003"/> </geometry> <material name= "White" > <c Olor rgba= "1 1 1.5"/> </material> </visual> </link> <link name= "Tyer_front_left" &G
    T <visual> <geometry> <cylinder length= ". 025" radius= "0.034" ></cylinder> </geo metry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> </ visual> </link> <link name= "Tyer_front_right" > <visual> <geometry> <cy  
          Linder length= ". 025" radius= "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> </geo metry> <material name= "Yellow" > <color rgba= "1 1 0 1"/> </material> & lt;/visual> </link> <link name= "Tyer_back_right" > <visual> <geometry> &   
          Lt;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= "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 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"/&
    Gt <parent link= "Base_link/> <child link=" Tyer_back_left "/> <axis xyz=" 0 0 1 "/> &LT;/JOINT&G

  T <joint name= "Base_to_back_right" type= "continuous" > <origin rpy= "1.57075 0 0" xyz= " -0.06-0.064-0.011"/&
    Gt <parent link= "Base_link/> <child link=" tyer_back_right "/> <axis xyz=" 0 0 1 "/> </joint&

  Gt <link name= "Pillar_front_left" > <visual> <geometry> <cylinder length= "radius=" 0 .0025 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> <material name=" Silve
R "> <color rgba=". 1 "/> </material> </visual> </link>
  <link name= "Pillar_front_right" > <visual> <geometry> <cylinder length= "." Radiu s= "0.0025" ></cylinder> </geometry> <origin xyz= "0 0 0.015"/> <material name= "s

  Ilver "> <color rgba=". 1 "/> </material> </visual> </link> <link name= "Pillar_back_left" > <visual> <geometry> <cylinder length= "radius=" 0.0025 "></cylinder> </geometry> <origin xyz=" 0 0 0.015 "/> <material name=" Silv Er "> <color rgba=". 1 "/> </material> </visual> </link> & Lt;link name= "Pillar_back_right" > <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_pil Lar_front_left "type=" fixed "> <origin xyz=" 0.13 0.07 0.0015 "/> <parent link=" Base_link "/>
    ; child link= "Pillar_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"/&gt
  ; 
    </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 "type=" fixed "> <origin xyz=" -0.13-0.07 0.0015 "/> <parent link=" Base_link "/> <child link= "Pillar_back_right"/> </joint> <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 "/> &LT;/JOINT&G
T </robot>



Copyright NOTICE: This article is the original article, without the owner's permission to reprint.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.