Ask Your Question
0

How to subcribe tf transform from map to odom by gmapping into odom to baselink?

asked 2015-02-06 03:11:15 -0500

mree gravatar image

Hi, I have an odometry obtained from encoders but it is not accurate enough. In long periods, the error accumulated the robot position not accurate. I know that gmapping publish a tf transform from map to odom. Can I subscribe this transform and add it into my odometry or the transform from odom to baselink so that the position of my robot is more accurate?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-02-06 04:09:15 -0500

dornhege gravatar image

Do not add anything manually. TF does that for you. Just use /map -> /base_link instead of /odom -> /base_link to get the robot position.

edit flag offensive delete link more

Comments

Sorry for late reply, but my odometry transform is from odom to base_link. How could achieve directly from /amp ->/base_link

mree gravatar image mree  ( 2015-03-05 04:49:58 -0500 )edit

my tf tree now is /map -> /odom -> base_link

is it what you means as below? /map -> /base_link /map -> /odom

mree gravatar image mree  ( 2015-03-05 04:53:15 -0500 )edit

tf tree looks good. Just use the map->base_link transform and you'll get your pose in the map.

dornhege gravatar image dornhege  ( 2015-03-05 05:56:39 -0500 )edit

Currently I am getting my robot position in map by this way:

odom.pose.pose.position.x = x_move;
odom.pose.pose.position.y = y_move;
odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation = tf::createQuaternionMsgFromYaw(w_move);
mree gravatar image mree  ( 2015-03-06 01:09:35 -0500 )edit

do you mean i should use this lookuptransform instead of odom to get my robot pose? something like this:

try { listener.lookupTransform("map", "base_link", ros::Time(0), transform_in_map); } catch(tf::TransformException &exception) { ROS_ERROR("%s", exception.what()); }

mree gravatar image mree  ( 2015-03-06 01:10:21 -0500 )edit

Yes! .

dornhege gravatar image dornhege  ( 2015-03-06 03:27:42 -0500 )edit

I have made this change:

odom.pose.pose.position.x = transform.getOrigin().x();
odom.pose.pose.position.y = transform.getOrigin().y();
odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation.z =tf::getYaw(transform.getRotation());;
mree gravatar image mree  ( 2015-03-10 06:12:56 -0500 )edit

However, when the odom frames move, the robot remains stationary. The transform from map to odom published by gmapping and amcl is not send to the base_link

mree gravatar image mree  ( 2015-03-10 06:14:17 -0500 )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: 2015-02-06 03:11:15 -0500

Seen: 1,218 times

Last updated: Feb 06 '15