ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Wed, 13 Nov 2013 18:19:27 -0600Gslam /tf coordinate problemshttps://answers.ros.org/question/9808/gslam-tf-coordinate-problems/So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.
(I am putting the frames inside () because I am not sure how else to signify the difference)
1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values.
2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)?
Thank
~BMSat, 23 Apr 2011 15:09:13 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/Comment by BlackManta for <p>So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.</p>
<p>(I am putting the frames inside () because I am not sure how else to signify the difference) </p>
<p>1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values. </p>
<p>2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)? </p>
<p>Thank</p>
<p>~BM</p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=26018#post-id-26018If this reposted I am sorry, my web-browser did something stupid.Sat, 23 Apr 2011 15:10:20 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=26018#post-id-26018Answer by BlackManta for <p>So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.</p>
<p>(I am putting the frames inside () because I am not sure how else to signify the difference) </p>
<p>1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values. </p>
<p>2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)? </p>
<p>Thank</p>
<p>~BM</p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14348#post-id-14348Okay I think I get that, thanks by the way. So the map is 4000 X 4000 occupancy ... I need to find the index where the robot is. So do I take the maps resolution and that is how I would find the array index for the robot? I think (thanks to your previous answer) I can get the relative coordinates which I need. But I don't know exactly how to transfer that into the occupancy grid space. For that matter I don't even know what indexes gslam starts making the map. (I would assume somewhere in the middle).
Thanks in advanced.
BMMon, 25 Apr 2011 16:43:39 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14348#post-id-14348Answer by BlackManta for <p>So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.</p>
<p>(I am putting the frames inside () because I am not sure how else to signify the difference) </p>
<p>1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values. </p>
<p>2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)? </p>
<p>Thank</p>
<p>~BM</p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14349#post-id-14349here is the echo dump of my /tf
transforms:
header:
seq: 0
stamp:
secs: 266
nsecs: 200000000
frame_id: /base_link
child_frame_id: /base_laser_link
transform:
translation:
x: 0.05
y: 0.0
z: 0.15
rotation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
transforms:
header:
seq: 0
stamp:
secs: 266
nsecs: 200000000
frame_id: /base_footprint
child_frame_id: /base_link
transform:
translation:
x: 0.0
y: 0.0
z: 0.0
rotation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
transforms:
header:
seq: 0
stamp:
secs: 266
nsecs: 200000000
frame_id: /odom
child_frame_id: /base_footprint
transform:
translation:
x: 0.0
y: -0.0
z: 0.0
rotation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
transforms:
header:
seq: 0
stamp:
secs: 266
nsecs: 200000000
frame_id: /map
child_frame_id: /odom
transform:
translation:
x: -0.0
y: -0.0
z: -0.0
rotation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
transforms:
header:
seq: 0
stamp:
secs: 266
nsecs: 200000000
frame_id: /map
child_frame_id: /odom
transform:
translation:
x: -0.0
y: -0.0
z: -0.0
rotation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
aplogize for the format...I can never get these things to work.
The point is base_frame says its 0,0 which is believable. I just don't know how to transfer the base_frame into the occupancy grid coordinates. Sorry if I am missing something here.
Thanks again,
BMMon, 25 Apr 2011 17:02:18 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14349#post-id-14349Answer by BlackManta for <p>So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.</p>
<p>(I am putting the frames inside () because I am not sure how else to signify the difference) </p>
<p>1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values. </p>
<p>2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)? </p>
<p>Thank</p>
<p>~BM</p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14350#post-id-14350Okay /map (the occupancy grid) is starting in the middle of the map (2000,2000) of a 4k X 4k grid. That was the piece I was confused about, I should be able to use the resolution of the map and translate meter position into index offset for the occupancy grid. The only trick is I am going to have to translate back from the occupancy grid to the real world when I write my motion planner but I will cross that bridge when I get there.
Thanks for the help,
BM Mon, 25 Apr 2011 18:24:24 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14350#post-id-14350Comment by raphael favier for <p>Okay /map (the occupancy grid) is starting in the middle of the map (2000,2000) of a 4k X 4k grid. That was the piece I was confused about, I should be able to use the resolution of the map and translate meter position into index offset for the occupancy grid. The only trick is I am going to have to translate back from the occupancy grid to the real world when I write my motion planner but I will cross that bridge when I get there.</p>
<p>Thanks for the help,
BM </p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=25993#post-id-25993Sure, the relationship between meters/cells is quite easy to find. keep us posted on your progress! :)Tue, 26 Apr 2011 01:34:53 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=25993#post-id-25993Comment by RB for <p>Okay /map (the occupancy grid) is starting in the middle of the map (2000,2000) of a 4k X 4k grid. That was the piece I was confused about, I should be able to use the resolution of the map and translate meter position into index offset for the occupancy grid. The only trick is I am going to have to translate back from the occupancy grid to the real world when I write my motion planner but I will cross that bridge when I get there.</p>
<p>Thanks for the help,
BM </p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=101046#post-id-101046Why the sequence numbers are zero. I try to build an occupancy map of 4k*4k grid and resolution is .05. But the map generated is an empty map. All the laser messages are properly published and tf tree seems to be ok.And no transform from [/GrndTruth] to frame[/map] and no transform from [/base_GrndTruth to frame[/map]. You can view the question in details http://answers.ros.org/question/94671/error-in-creating-2d-global-map-of-the-environment/Wed, 13 Nov 2013 18:19:27 -0600https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?comment=101046#post-id-101046Answer by raphael favier for <p>So I am using gmapping slam_gmapping base:=scan with rosstage and things are going nicely. (I am using rviz). There are two questions which I am sure are nooby, but I can't find the answers anywhere.</p>
<p>(I am putting the frames inside () because I am not sure how else to signify the difference) </p>
<p>1) The first problem is /tf (base_footprint) and /tf (base_link) and /tf (base_laser_link) all give me a believable value of 7.9, .83 (I let the robot move in a straight line for a little bit). However, if I am reading the gslam tutorial correctly, I should be using /tf (/map) for the transform in the map space. It is giving me the following values -0.004988, -0.01188
The size of the map is 4000,4000 and the resolution is .05. But I am not sure how to tranform these values into real world values. </p>
<p>2) I am hoping that the answer for the first question will answer the second one, but I am given an occupancy grid for a map that is 4000 X 4000 I need to be able to translate Slam coordinates (or real world coordinates) into this discrete space. Is this the same transfer function as the /tf(/map)? </p>
<p>Thank</p>
<p>~BM</p>
https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14334#post-id-14334Hello,
I'm not sure if I fully understand what you want to do. In a typical case, you should have a main robot frame, say base_link, that should represent your robot.
The transformation map->base_link gives you the position of the robot (in meters) from the origin of the map.
This origin is fixed in the yaml file you use to initialize [map_server](http://www.ros.org/wiki/map_server) (see section 2.2). It is a bit tricky, as the origin is in fact the bottom left pixel of the map picture.
To know how far your robot moved from its position of origin in the map, you need to store the first transform map->base_link and use it as your "zero".
Hope it helps
RaphSun, 24 Apr 2011 13:26:06 -0500https://answers.ros.org/question/9808/gslam-tf-coordinate-problems/?answer=14334#post-id-14334