Why do I need the static transform if my urdf is properly defined?
Hi,
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.
EDIT
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.
<launch>
<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>
<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"/>
</launch>
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.
EDIT 2:
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"?>
<launch>
<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 ...
Are you using robot_state_publisher with your URDF?
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.
I edited the question.
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.
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.