Wrong connection in tf2 tree

asked 2022-07-12 10:43:54 -0500

OguzKahraman gravatar image

Hello all. I am getting a following tf2 tree even though wheel joints are connected to base link. In tf2 tree, it shows that joints are connected to base_footprint. My urdf file is :

<!-- ********************** ROBOT BASE *********************************  -->   
<link name="base_link">
<visual>
  <origin xyz="0 0 -0.05" rpy="1.5707963267949 0 3.141592654"/>
  <geometry>
    <mesh filename="file://$(find two_wheeled_robot)/meshes/robot_base.stl" />
  </geometry>
  <material name="Red">
    <color rgba="1.0 0.0 0.0 1.0"/>
  </material>
</visual>

<collision>
  <geometry>
    <box size="${base_length} ${base_width} ${base_height}"/>
  </geometry>
</collision>

<xacro:box_inertia m="15.0" w="${base_width}" d="${base_length}" h="${base_height}"/>   
   </link>
<gazebo reference="base_link">
    <material>Gazebo/Red</material>   
</gazebo>

  <!-- ****************** ROBOT BASE FOOTPRINT ***************************  -->   <!-- Define the center of the main robot chassis projected on the ground -->      <link name="base_footprint">
<xacro:box_inertia m="0" w="0" d="0" h="0"/>   </link>
<!-- The base footprint of the robot is located underneath the chassis -->   
 <joint name="base_joint" type="fixed">
<parent link="base_footprint"/>
<child link="base_link"/>
<origin xyz="0.0 0.0 ${-(wheel_radius+wheel_zoff)}" rpy="0 0 0"/>   </joint>
<!-- *********************** DRIVE WHEELS ****************************** -->   
   <xacro:macro name="wheel" params="prefix x_reflect y_reflect">
<link name="${prefix}_link">
  <visual>
    <origin xyz="0 0 0" rpy="${pi/2} 0 0"/>
    <geometry>
        <cylinder radius="${wheel_radius}" length="${wheel_width}"/>
    </geometry>
    <material name="Gray">
      <color rgba="0.5 0.5 0.5 1.0"/>
    </material>
  </visual>

  <collision>
    <origin xyz="0 0 0" rpy="${pi/2} 0 0"/> 
    <geometry>
      <cylinder radius="${wheel_radius}" length="${wheel_width}"/>
    </geometry>
  </collision>

  <xacro:cylinder_inertia m="0.5" r="${wheel_radius}" h="${wheel_width}"/>
</link>

<!-- Connect the wheels to the base_link at the appropriate location, and  define a continuous joint to allow the wheels to freely rotate about an axis -->
<joint name="${prefix}_joint" type="continuous">
  <parent link="base_link"/>
  <child link="${prefix}_link"/>
  <origin xyz="${x_reflect*wheel_xoff}  ${y_reflect*(base_width/2+wheel_ygap)}  ${-wheel_zoff}" rpy="0 0 0"/>
  <axis xyz="0 1 0"/>
</joint>   </xacro:macro>
<!-- Instantiate two wheels using the macro we just made through the  xacro:wheel tags. We also define the parameters to have one wheel on both sides at the back of our robot (i.e. x_reflect=-1). -->  
 <xacro:wheel prefix="drivewhl_l"
  x_reflect="-1" y_reflect="1" />  
  <xacro:wheel prefix="drivewhl_r"
   x_reflect="-1" y_reflect="-1" />

I cannot upload an image but tf tree is :

basefootprint => drivewhl_r_link , drivewhl_l_link, base_link base_link => front_caster, imu_link, lidar_link

Under this configurations, it should be base_footprint => base_link => .... (rest) Am I wrong?

edit retag flag offensive close merge delete