Ask Your Question

Using map for pose estimation [closed]

asked 2015-05-19 03:41:58 -0500

Erwan R. gravatar image

updated 2015-05-19 10:58:35 -0500


Quite a newbie question, but I can't understand the right way to do things properly. (I'm using groovy under Ubuntu 12.04).

I want to get a position and orientation estimations of my PR2 robot (simulated or real) in my node.

I have gmapping running that builds me a map and publish a transform between the frame odom_combined and map. On the other hand, I subscribed to the /robot_pose_ekf/odom_combined topic and I get frequent odometry pose estimations. I understand that I could use AMCL for localisation (which provides the amcl_pose topic) but to keep my architecture simple, I just want to use gmapping. I don't use only the odom estimation because of its drift over time.

I also "lookup for transform" between odom and map :

    nhCall_.getParam("gmapping_node/odom_frame", frameToTransform);
    listener.lookupTransform("/map", frameToTransform, ros::Time(0), transform_base);

But how do I use the transform (transform_base) as a pose estimation ? As it is a StampedTransform, I can't directly set it as my pose. When trying to set, field by field the Pose message with the transform data, I end up with the following warning :

[ WARN] [1432023038.082861765, 6687.377000000]: MSG to TF: Quaternion Not Properly Normalized

and I'm not sure normalizing it by hand is the best solution (the warning still appears when rotating). So can someone explain me the right way to use a transform for pose estimation ?

Thanks, Erwan

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Procópio
close date 2015-06-29 02:19:37.332277

2 Answers

Sort by » oldest newest most voted

answered 2015-05-20 10:25:00 -0500

Procópio gravatar image

updated 2015-05-20 10:31:05 -0500

Forgetting about your mapping and slam setup, the way to get your robot position is to get a transform from your /base_frame to /map (and not /odom to /map, as ideally it should be constant and only changes due to drift errors, check the image in the bottom of this page). Once you have that transform, you can obtain the position of your robot using the getOrigin() method, as shown in this example.

related question here.

bonus: if you want to try a very simple SLAM setup, I suggest you try hector_slam.

edit flag offensive delete link more

answered 2015-05-20 04:46:13 -0500

Just to point out that, if you are using GMapping, you cannot use AMCL too: GMapping is a SLAM algorithm including localization in itself.

BTW, do you try to normalize the quaternion by normalize() method before create your message? See tf::Quaternion documentation.

edit flag offensive delete link more


Thanks for answering ! To my experience, AMCL and gmapping aren't incompatible, and AMCL requires a map, so a good way to provide this is from gmapping and the poses estimates from both methods aren't writing on the same topic. I didn't use normalize, I'm gonna give it a try.

Erwan R. gravatar image Erwan R.  ( 2015-05-20 07:34:15 -0500 )edit

Question Tools

1 follower


Asked: 2015-05-19 03:41:58 -0500

Seen: 960 times

Last updated: May 20 '15