Ask Your Question
0

amcl_pose topic returns different than the map->odom->base transform

asked 2018-11-06 15:31:31 -0600

FriendlyFire gravatar image

updated 2018-11-07 17:15:19 -0600

As the title states, amcl_pose is not giving me the same result as taking the map->odom transform and then combining that with the odom->base transform. I was originally using the map->odom transform to just correct my drift, but if anything it seems like amcl_pose is right, and the map->odom is wrong, at least based on comparing what I see on Rviz with where my robot actually was.

Rather than just swapping to amcl_pose I want to try and understand what is happening. Let me just show some culled log files from a ROS node that takes in my robots scans/odometry, publishes them for AMCL, and also listens for the amcl_pose topic to be published... All values are (x,y,theta) by the way:

[ INFO] [1541537079.104442235]: amcl_pose = 0.979757,1.041833,1.677116

[ INFO] [1541537079.104487697]: map->odom = 0.081080,-0.287248,0.212756

[ INFO] [1541537080.089657443]: odom->base = 1.164587,1.157537,1.452360

[ INFO] [1541537081.010870954]: odom->base = 1.170495,1.207187,1.452360

[ INFO] [1541537082.035011221]: odom->base = 1.176403,1.256837,1.452360

[ INFO] [1541537083.058245129]: odom->base = 1.181755,1.305040,1.464360

[ INFO] [1541537084.082075926]: odom->base = 1.186469,1.353310,1.476360

[ INFO] [1541537085.003592600]: odom->base = 1.190543,1.401638,1.488360

[ INFO] [1541537086.027702051]: odom->base = 1.193791,1.448525,1.512360

[ INFO] [1541537087.052686791]: odom->base = 1.196423,1.496953,1.524360

[ INFO] [1541537088.076706817]: odom->base = 1.198293,1.545416,1.536360

[ INFO] [1541537088.997988424]: odom->base = 1.199228,1.592406,1.560360

[ INFO] [1541537089.104671886]: amcl_pose = 0.880494,1.507386,1.807045

[ INFO] [1541537089.104765416]: map->odom = 0.106420,-0.329653,0.246685

You can clearly see that the last amcl_pose says the robot is at X=0.880494, but removing the drift error AMCL also published from the last published odometry value returns X=1.199-0.106=1.093. The Y value is even farther off!

I don't know if I'm misunderstanding something about AMCL, or misusing it somehow. These should be the same right? Thanks for any help.


Update: mgruhler pointed out what I was doing wrong, but I'll explain what I should have done if anyone has the same problem and stumbles upon this:

The odom->base vector is in the odometry frame, a different frame of reference than the map frame. Since there is a rotation between the two, that means you cannot simply sum up their vectors.

Using a rotation matrix with the known rotation (0.246685rad in this case) on the odom->base vector to converts it into the map frame, and then it can simple be summed up with the map->odom vector, and you get the expected answer.


Miscellanious info I don't think matters for this issue: Ubuntu 16.04 LTS ROS kinetic 1.12.14

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-11-06 19:12:57 -0600

mgruhler gravatar image

Most probably amcl is right and you are computing your values incorrectly.

As the transforms you get (i.e. odom->base as well as map->odom) are not in the same frame, you cannot just add up the single components. The frames (in this case, odom with respect to map) is rotated. So you have to adjust the x and y components according to the orientation. I'll leave it up to you to verify this is correct. Check how to transform coordinate systems.

If you want to get the transform from map to base in ROS, you can directly ask tf to get you this instead of manually adding up the transforms.

edit flag offensive delete link more

Comments

Thanks, never thought about that. This also means I can't simply maintain a static error of my odometry on my robot, only updating it occasionally with AMCL. Based on the rotational error AND odometry, I have to constantly update that X/Y error to get my true position. Darn!

FriendlyFire gravatar imageFriendlyFire ( 2018-11-07 17:09:50 -0600 )edit

Yes, but why would you want to do that? This would basically lead to your robot having an error in localization that grows and grows until you do an update...

mgruhler gravatar imagemgruhler ( 2018-11-08 03:39:11 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-11-06 15:31:31 -0600

Seen: 66 times

Last updated: Nov 07 '18