ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why is robot_state_publisher not publishing correct tf transforms?

asked 2021-03-24 13:28:21 -0600

Skhanna gravatar image

updated 2021-03-24 14:54:20 -0600

I am trying to use the robot_state_publisher to publish transforms between my links.

My launch file is:

<?xml version="1.0"?>
<launch>
  <arg name="model" />
  <arg name="gui"  default="False" />
  <param name="use_gui"  value="$(arg gui)" />
  <param  name="robot_description"  textfile="$(find robot_description)/urdf/ROSYZ01SS.urdf" />
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" >
    <param name="publish_frequency" type="double" value="20" />
    <param name="use_tf_static" type="bool" value="false" />
  </node>
</launch>

And my URDF file has multiple links, similar to this:

<?xml version="1.0"?>
<robot name="smartcar">
  <link name="base_link">
  <!--link name="base_footprint"-->
    <visual>
      <geometry>
        <cylinder length="0.35" radius="0.17"/>
      </geometry>
      <origin xyz="0 0 .21" rpy="0 0 0" />
      <material name="blue">
        <color rgba="0 1 .8 0.5"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <cylinder length="0.35" radius="0.17"/>
      </geometry>
      <origin xyz="0 0 .21" rpy="0 0 0" />
    </collision>
 </link>

  <link name="laser">
    <visual>
      <geometry>
        <cylinder length="0.04" radius="0.035"/>
      </geometry>
      <material name="white">
        <color rgba="1 .5 .5 1"/>
      </material>
      <origin xyz="0 0 0.22" rpy="0 0 0" />
   </visual>
   <collision>
     <geometry>
       <cylinder length="0.04" radius="0.035"/>
     </geometry>
     <origin xyz="0 0 0.22" rpy="0 0 0" />
   </collision>
 </link>

 <joint name="bb" type="fixed">
    <parent link="base_link"/>
    <child link="laser"/>
 </joint>
</robot>

My tf tree looks OK, but the published transforms themselves are not. All of the transforms look like this:

header: 
  seq: 0
  stamp: 
    secs: 1616605801
    nsecs: 778988702
  frame_id: "base_link"
child_frame_id: "laser"
transform: 
  translation: 
    x: 0.0
    y: 0.0
    z: 0.0
  rotation: 
    x: 0.0
    y: 0.0
    z: 0.0
    w: 1.0

Is there something I am doing wrong? Why are the transforms publishing, but appear to be incorrect?

edit retag flag offensive close merge delete

Comments

1

Your URDF shows two links connected by a joint with no transform, so the output looks correct. What were you expecting?

jdlangs gravatar image jdlangs  ( 2021-03-24 15:55:53 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-03-24 17:20:17 -0600

clyde gravatar image

Specify the relationship between the 2 links using the joint origin, e.g.,

 <joint name="bb" type="fixed">
    <origin xyz="0 0 1" rpy="0 0 3.1416"/>
    <parent link="base_link"/>
    <child link="laser"/>
 </joint>

See http://wiki.ros.org/urdf/XML/joint for more info.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-24 13:25:53 -0600

Seen: 766 times

Last updated: Mar 24 '21