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();
}