ROS 中Failed to find root link: Two root links found: [base_footprint] and [base_link]

在编写小车urdf过程中,出现下面错误

Failed to find root link: Two root links found: [base_footprint] and [base_link]

 <link name="base_link">
  <inertial>
    <origin xyz="-0.0297223458239662 0.00885393359209172 0.0908337009417238" rpy="0 0 0" />
    <mass value="26.9449323487092" />
    <inertia ixx="0.161309568708359" ixy="-3.60659406063394E-05" ixz="-0.000200143769478037" iyy="0.162151895045931" iyz="-5.52382803734224E-05" izz="0.294908497251133" />
  inertial>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <mesh filename="package://robot_model/meshes/base_link.STL" />
    geometry>
    <material name="">
      <color rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    material>
  visual>

  <collision>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <mesh filename="package://robot_model/meshes/base_link.STL" />
    geometry>
  collision>
  link>

  <link name="base_footprint">
  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <box size="0.001 0.001 0.001" />
    geometry>
  visual>
  <joint name="base_footprint_joint" type="fixed">
    <origin xyz="0 0 0.033" rpy="0 0 0" />        
    <parent link="base_footprint"/>
    <child link="base_link" />
  joint> 
  link>

原因:

1、注意每定义个link都要为它添加一个关节

2、注意link和joint的顺需,joint需要在link后,写完link后再写joint,就是在 < l i n k > < / l i n k > <link></link>后再写joint


  <link name="base_link">
  <inertial>
    <origin xyz="-0.0297223458239662 0.00885393359209172 0.0908337009417238" rpy="0 0 0" />
    <mass value="26.9449323487092" />
    <inertia ixx="0.161309568708359" ixy="-3.60659406063394E-05" ixz="-0.000200143769478037" iyy="0.162151895045931" iyz="-5.52382803734224E-05" izz="0.294908497251133" />
  inertial>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <mesh filename="package://robot_model/meshes/base_link.STL" />
    geometry>
    <material name="">
      <color rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    material>
  visual>

  <collision>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <mesh filename="package://robot_model/meshes/base_link.STL" />
    geometry>
  collision>
  link>

  <link name="base_footprint">
  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <box size="0.001 0.001 0.001" />
    geometry>
  visual>
  link>
  
  <joint name="base_footprint_joint" type="fixed">
    <origin xyz="0 0 0.033" rpy="0 0 0" />        
    <parent link="base_footprint"/>
    <child link="base_link" />
  joint> 
 

你可能感兴趣的:(ros,xml)