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

error while building 2d map

asked 2016-06-18 11:54:49 -0500

ghaith gravatar image

updated 2016-10-24 09:04:19 -0500

ngrennan gravatar image

hi i am trying to build 2d map i go just part of the map and git in the axis error that say in rviz: Transform For frame [base_link]: No transform to fixed frame [map]. TF error: [Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.] ithe odometery data are publishing and the kinect work fine i don't know where the problem is i will include all the information that can help: i am using indigo first i use this launch file


<node pkg="tf" type="static_transform_publisher" name="base_to_kinect_broadcaster" args="-0.17 0.04 0.1975 0 0 0 \/base_link \/camera_link 100"/>

<include file="$(find beginner_tutorials)/launch/kinect_laser.launch"/>

<node name="arduino_serial_node" pkg="rosserial_python" type="" output="screen">

<param name="port" value="/dev/ttyACM0" />

<param name="baud" value="115200" />


<node name="base_controller_node" pkg="beginner_tutorials" type="base_controller">

<param name="publish_tf" value="true" />

<param name="publish_rate" value="10.0" />

<param name="linear_scale_positive" value="0.99" />

<param name="linear_scale_negative" value="0.99" />

<param name="angular_scale_positive" value="1.0" />

<param name="angular_scale_negative" value="1.0" />

<param name="angular_scale_accel" value="0.0" />

<param name="alpha" value="0.5" />

<param name="use_imu" value="true" />





<include file="$(find beginner_tutorials)/launch/view_mobile_robot.launch"/>

<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen"> </node>

<node name="teleop" pkg="teleop_twist_keyboard" type="" output="screen" launch-prefix="xterm -e"/>

<node pkg="rviz" name="rviz" type="rviz" args="-d $(find beginner_tutorials)/launch/rviz/slam.rviz"/>


and it must run good base controller is running without any problem and publish the odom data the tf tree and rviz Screenshot from 2016-06-18 19:51:20.png Screenshot from 2016-06-18 19:52:30.png

i hope this can help.

note: you can find base_controller in this package I use it as a reference with some difference but the tf publish is the same . I am launch robot config and slam.launch from this package I hope this information will help.

note2: after adding this line befor launch

rosrun tf static_transform_publisher 0 0 0 0 0 0 map base_footprint 100 no error occure in rviz but still the axises don't move when the robot move i still don't know why this is the tree after adding this line image description

it's make the map in the same place don't move and the in the odom data seq: 1839 stamp: secs: 1466341747 nsecs: 223550043 frame_id: /odom child_frame_id: /base_link pose: pose: position: x: 0.00107754043214 y: -0.000931717192192 z: 0.0 orientation: x: 0.0 y: 0.0 z: -0.260476129843 w: 0.96548028762

when the position change no change in the position of the robot while building the map.

note3: i use this befor the launch and this make appropriate tf tree

rosrun tf static_transform_publisher 0 0 0 0 0 0 odom base_footprint 100

and this is the tree

image description

and here no problem occure in ... (more)

edit retag flag offensive close merge delete


Are you publishing map->odom transformation anywhere or is it there by default?

Shantnu gravatar image Shantnu  ( 2016-06-18 16:02:54 -0500 )edit

i use the control base from this package with some difference but still the method of publish tf is th same I hope this will help.

ghaith gravatar image ghaith  ( 2016-06-18 18:10:37 -0500 )edit

So basically some node name base_controller which belongs to beginner_tutorials pkg is publishing the tf for you? Is that correct?

Shantnu gravatar image Shantnu  ( 2016-06-18 20:55:11 -0500 )edit

Secondly, the problem is the missing connection between base_link and map frame. To set that up, try doing this in your terminal before launching your launch file:

rosrun tf static_transform_publisher 0 0 0 0 0 0 map base_footprint 100

Shantnu gravatar image Shantnu  ( 2016-06-18 20:59:33 -0500 )edit

it feels like the sequence of tf is wrong. It should be like map->odom-> base_footprint-> base_link. For you, it odom comes after base_footprint, which feels weird.

Shantnu gravatar image Shantnu  ( 2016-06-18 21:01:32 -0500 )edit

this work but still the axises don't move when the robot move but in rviz no error occure every thing work fine but the axises don't move i don't know why

ghaith gravatar image ghaith  ( 2016-06-19 08:12:02 -0500 )edit

how i can solve this how i can make footprint child of odom and father of base linke i think this will solve move problem

ghaith gravatar image ghaith  ( 2016-06-19 08:23:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-21 08:54:51 -0500

updated 2016-06-22 10:33:09 -0500

OK, so you have two problems here that I can see off the bat, and they are both related.

First, get rid of the static transform from map->base_footprint. Gmapping knows to update the map when that transform changes (either in translation or rotation) by a user specified amount. By using a static transform, that transform will never change and therefore the map will never update.

Second, looking at Screenshot from 2016-06-18 19:51:20.png, you can see that there is no transform between odom->base_footprint. You may have something publishing an nav_msgs/Odometry message, but there is nothing publishing the transform to the tf topic. I don't know what your odometry node looks like, but it seems to be missing the transform publisher. Take a look at lines 43-55 in the sample code of the odom tutorial.

[EDIT] Change the t.child_frame_id = base_link; to t.child_frame_id = base_footprint;. Frames can have multiple children but only a single parent. The way it is set up now, base_link is the child of both base_footprint and odom. As this isn't allowed it will latch onto the first parent to be published, in this case base_footprint.

edit flag offensive delete link more


thanks for replay i update post and the odemtery is published in the same way

ghaith gravatar image ghaith  ( 2016-06-21 09:58:19 -0500 )edit

this solution work great no problem but just small question now when the robot move just turn the axies is it in the odometery problem . the robot don't move forward but building the map without any problem but it turn around the same point

ghaith gravatar image ghaith  ( 2016-06-21 10:32:48 -0500 )edit

The map only rotates around the z axis, there is no translation? Can you give me a link to the node you are using?

Icehawk101 gravatar image Icehawk101  ( 2016-06-21 10:55:27 -0500 )edit

i am using the appropriately the same method in this package in the base controller node i don't know what the problem i am publish the imu from arduino this is all the defferince and i run robot confg launch and slam all the odom change

ghaith gravatar image ghaith  ( 2016-06-21 11:38:28 -0500 )edit

when i move forward x and y change and it's positve if i move back ward x and y will be negative and if imove left x will be + and y - and so on so i don't know what is the reason every thing work fine and the robot move in the real world but not in the map in the map just rotate in the z axis

ghaith gravatar image ghaith  ( 2016-06-21 11:40:22 -0500 )edit

That sounds like the kinematics are wrong. What kind of robot is it? Omnidirectional, skid-steer, or ackerman?

Icehawk101 gravatar image Icehawk101  ( 2016-06-21 12:33:34 -0500 )edit

it's diff wheels robot

ghaith gravatar image ghaith  ( 2016-06-21 12:36:04 -0500 )edit

if there any other way to set the kinematics plz give it to me any tutorial or example or even an issue it will be great and thanks for your help .

ghaith gravatar image ghaith  ( 2016-06-21 12:39:51 -0500 )edit

Question Tools

1 follower


Asked: 2016-06-18 11:54:49 -0500

Seen: 1,068 times

Last updated: Jun 22 '16