ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

mdm's profile - activity

2013-03-21 21:05:59 -0500 received badge  Famous Question (source)
2013-02-28 04:38:41 -0500 commented answer Slam_gmapping tutorial problem with time sync on rosbag

did that and i says "frame /map doesn't exist"

2013-02-28 04:18:12 -0500 commented answer Slam_gmapping tutorial problem with time sync on rosbag

now i totally lost you. there is no frame "/robot1/odom" anywhere. i did tf monitor and there isn't any with that name/id

2013-02-28 03:52:47 -0500 received badge  Notable Question (source)
2013-02-28 03:51:24 -0500 received badge  Scholar (source)
2013-02-28 01:42:43 -0500 received badge  Student (source)
2013-02-28 01:13:02 -0500 answered a question Slam_gmapping tutorial problem with time sync on rosbag

first of all, thank you for answering.

i did try it all you said even before posting the question.

still haven't found any solution to my problem with reading that tf. Tf with command tf tf_echo /map /odom looks alright: "Traslation: (-0.336 , 0.318, 0.000)" , and still I can't get it right.

lets add things up on my question:

  • rosbag play --clock basic_localization_stage.bag is command I start the .bag

  • rosrun gmapping slam_gmapping scan:=base_scan

  • rosparam set /use_sim_time true in CLI

  • then start my node to read tf

and this is what i get: "Lookup would require extrapolation into the past. Requested the time 38.9583

but the earliest data is at time 39.1473, when looking up transform

from frame /map to /odom"

I place new code to it: (now it has waiting for tf, and still wrong one)

tf::TransformListener listener;
ros::Rate rate(1.0);
while (nh.ok()){
    tf::StampedTransform tfTransform;
    try{
        ros::Time now = ros::Time::now();
        listener.waitForTransform("/odom", "/map",
                                  now, ros::Duration(5.0));
        listener.lookupTransform("/odom", "/map",
                                 now, tfTransform);
    }
    catch(tf::TransformException &exception) { 
        ROS_ERROR("%s", exception.what());
    }

    ROS_INFO("%f %f %f", tfTransform.getOrigin().x(), tfTransform.getOrigin().y(), tfTransform.getOrigin().z());
    rate.sleep();

}

2013-02-28 00:44:34 -0500 received badge  Popular Question (source)
2013-02-27 06:00:28 -0500 received badge  Supporter (source)
2013-02-27 05:58:59 -0500 received badge  Editor (source)
2013-02-27 05:56:59 -0500 asked a question Slam_gmapping tutorial problem with time sync on rosbag

Hello. I finished gmapping tutorial and started rosbag play and slam_gmapping (rosrun gmapping slam_gmapping scan:=base_scan). I needed to read tf from that gmapping, lets say between odom->map.

Once started rosbag and slam_gmapping time wasn't right, solved it with 'param set /use_sim_time true' before starting rosbag. With the code bellow I was reading tf and got this values:

x = 1134749241 y = -1078897170 z = -1255994495

x = 1134749241 y = -1078897170 z = -1255994495

x = 1134749241 y = -1078897170 z = -1255994495

x = 1134749241 y = -1078897170 z = -1255994495

  • not same every time, only in this example <- not an issue

Those values are too big to be real tf, so i need help with correct reading of tf from rosbag AND slam_gmapping.

Code to read tf:

tf::TransformListener listener;

ros::Rate rate(1.0);
while (nh.ok()){
tf::StampedTransform tfTransform;

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

ROS_INFO("%d %d %d", tfTransform.getOrigin().x(), tfTransform.getOrigin().y(), tfTransform.getOrigin().z());
rate.sleep();
}