# Fake localization using bag file in ROS

I have a bag file that contains couple of topics needed for localization, odometry data, kinect data and /tf. What I want is watching robot's movement path in rviz after initializing robot position (even I don't know how to initial it). Any help?

All topics:

/scan
/tf
/clock
/map
/odom

• I don't understand the question – perhaps you could add some context and explain a bit more – James Waldby - jwpat7 Nov 21 '13 at 16:26
• Well, I have recorded data inside a bag file using a wheeled root, right? I've generated map of the environment using that bag file. Now, I want to use these data to see the path of robot inside rviz. – Maysam Nov 22 '13 at 7:07
• you might have a better chance of getting an answer for this question if you ask it on the the ROS q/a site: answers.ros.org/questions – Robz Dec 1 '13 at 0:17
• @Robz I did, people there are way too lazy! – Maysam Dec 1 '13 at 12:04
• Not 100% sure where's the problem: what do you mean by "after initializing robot position"? Do you mean that you want to run some localisation algorithm on those data? Or did you record the result of the localisation algorithm and simply want to display it? – Ugo Dec 2 '13 at 11:18

Before you run rviz, you need to set use_sim_time to true:

rosparam set use_sim_time true


Now start up rviz, then run rosbag using --clock:

rosbag play bagfile_name.bag --clock


For setting up rviz with the navigation stack, you will want to follow this tutiorial.

For localisation you need map of the environment. For the data you have, you should use SLAM algorithm which give path and map of your environment. Try using gmapping in ROS.

• I have map too, sorry I forgot to write its topic name. – Maysam Mar 2 '14 at 8:57
• use amcl to localise your robot – nayab Mar 2 '14 at 13:45