ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

StampedTransform getting Position instead of Relative Position

asked 2015-01-30 11:43:26 -0500

choog gravatar image

HI, I am trying to log some data. The code works like intended except I am receiving the Relative Position instead of the Position.

tf::StampedTransform transformOdom;
current_time = ros::Time::now();

try {
        listener.waitForTransform( "odom","base_footprint", ros::Time(0), ros::Duration(10.0));
    listener.lookupTransform( "odom", "base_footprint",ros::Time(0), transformOdom);
    catch (tf::TransformException &ex) {

//For debugging purposes
ROS_INFO_STREAM("X pose " <<  transformOdom.getOrigin().x() );
ROS_INFO_STREAM("Y pose " << transformOdom.getOrigin().y()); ("log.txt", ios_base::app);
fileToWrite << "X: " << transformOdom.getOrigin().x() << " Y: " << transformOdom.getOrigin().y()<< "\n";

Here is where you can see the two different positions from the visualization software

Does anyone know how to get the position of the robot instead of the relative position?

Thanks, choog

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-01-30 11:47:34 -0500

dornhege gravatar image

You need to choose a frame that you consider fixed, e.g., /map.

edit flag offensive delete link more



listener.waitForTransform( "map","base_footprint", ros::Time(0), ros::Duration(10.0)); listener.lookupTransform( "map", "base_footprint",ros::Time(0), transformOdom);

as such?

choog gravatar image choog  ( 2015-01-30 11:50:37 -0500 )edit

That worked. I figured that is what you meant and it tried. Thanks a lot.

choog gravatar image choog  ( 2015-01-30 11:55:42 -0500 )edit

Hi! I met the same problem just like you, I changed "odom" with "map", instead, I got this error "map" passed to lookupTransform argument target_frame does not exist. Can you tell me what should I do ? I don't even know what odom means. CuzI just started to learn ROS ;(,Thx anyway

Henschel.X gravatar image Henschel.X  ( 2016-03-21 20:48:08 -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



Asked: 2015-01-30 11:43:26 -0500

Seen: 1,297 times

Last updated: Jan 30 '15