Rosanswers logo


As the questions says, I do not understand why do we need the static_transform_publisher when the urdf model of the robot with all sensors is properly defined in the urdf file. Doesn't loading the urdf places all the tf's correctly. If so, why do we need to remap frames most of the times for example when using hector_slam ? Can someone explain.


I would edit my question for better understanding. I am using pioneer p3dx for 2d slam mapping. Here is my launch file that I use for moving the robot around. I am using it with kinect and a hokuyo laser sensor. The position of the kinect and laser is defined in the urdf files properly and I can visualize them on the rviz.


  <node pkg="rosaria" type="RosAria" name="RosAria"/>
  <node pkg="topic_tools" type="relay" name="relay1" args="/RosAria/pose /odom" />
  <node pkg="topic_tools" type="relay" name="relay2" args="/cmd_vel /RosAria/cmd_vel" />

  <param name="robot_description" command="$(find xacro)/xacro.py '$(find kinect)/urdf/p3dx_real.xacro'" />

  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="20.0" />
  <node pkg="tf" type="static_transform_publisher" name="static_transform_publisher" args="0 0 0 0 0 0 base_link base_footprint 50"/>
  <node pkg="tf" type="static_transform_publisher" name="static_transform_publisher2" args="-0.2 0 0.036 0 0 0 base_link center_wheel 50"/>
  <node pkg="tf" type="static_transform_publisher" name="static_transform_publisher3" args="-0.178 0 0.052 0 0 0 base_link swivel 50"/>


Now, i launch the kinect and hokuyo files separately. I can make fairly good maps using the gmapping and my tf's do not give me any error when using the gmapping.

when I want to use the hector slam, because I know my urdf is proper, when I use the parameters for scan --> /scan , odom --> /odom and map ---> /map. I always get TF error about base_link to base_laser not defined.

Why is that? I am guessing if it is because somehow my tf from the urdf are not being read or I am missing a tf link in between. But why then the Gmapping seems to work perfectly on the same robot model.


I am attaching my tf view_frames. You can see that the base_laser has the parent as base_link. Mostly the tf frame is flattened. See the attached frames pdf file

Here's my launch file:

<?xml version="1.0"?>

  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_link"/>
  <arg name="odom_frame" default="odom"/>
  <arg name="pub_map_odom_transform" default="true"/>
  <arg name="scan_subscriber_queue_size" default="5"/>
  <arg name="scan_topic" default="scan"/>
  <arg name="map_size" default="4048"/>
  <node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
    <!-- Frame names -->
    <param name="map_frame" value="map" />
    <param name="base_frame" value="base_link" />
    <param name="odom_frame" value="odom" />
    <!-- Tf use -->
    <param name="use_tf_scan_transformation" value="true"/>
    <param name="use_tf_pose_start_estimate" value="false"/>
    <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>
    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="$(arg map_size)"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />
    <!-- Map update parameters -->
    <param name="update_factor_free" value="0.4"/>
    <param name="update_factor_occupied" value="0.9" />    
    <param name="map_update_distance_thresh" value="0.4"/>
    <param name="map_update_angle_thresh" value="0.06" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />
    <!-- Advertising config --> 
    <param name="advertise_map_service" value="true"/>
    <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
    <param name="scan_topic" value="$(arg scan_topic)"/>
    <!-- Debug parameters -->
      <param name="output_timing" value="false"/>
      <param name="pub_drawings" value="true"/>
      <param name="pub_debug_output" value="true"/>
    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
  <!--<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 map nav 100"/>-->

Originally posted by AlexR on ROS Answers with karma: 654 on 2014-12-06

Post score: 3

Original comments

Comment by ahendrix on 2014-12-07:
Are you using robot_state_publisher with your URDF?

Comment by tfoote on 2014-12-07:
Please edit your question to explain a little more about what you're doing and how you're using the static_transform_publisher. To be able to explain why to do something we will need to know what you're doing.

Comment by AlexR on 2014-12-09:
I edited the question.

Comment by tfoote on 2014-12-09:
Thanks for the update. Can you share a little bit more? Maybe what are the frames in your robot model? What is the output of view_frames.py when you're running the two setups? We need to debug what's different about the systems.

Comment by tfoote on 2014-12-09:
As a side comment you should use remapping instead of relays for things like changing topics. It's much more efficient as it actually changes the topic publishing instead of receiving it and rebroadcasting it. Take a look at rqt_graph to see the difference.


1 Answer 1


Rosanswers logo

The final solution you have only has one static transform publisher, and I think that's necessary to connect map to nav since you are not running a localization module. Usually amcl or gmapping are used.

Originally posted by tfoote with karma: 58457 on 2015-03-02

This answer was ACCEPTED on the original site

Post score: 3


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.