0
$\begingroup$

Rosanswers logo

Hello,

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 :

(...)
try
{
    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


Originally posted by Erwan R. on ROS Answers with karma: 697 on 2015-05-19

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Procópio with karma: 4402 on 2015-05-20

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by afranceson with karma: 497 on 2015-05-20

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Erwan R. on 2015-05-20:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.