0
$\begingroup$

Rosanswers logo

(ROS Hydro on Ubuntu 12.04)

I am following the tutorial on Recording and Playing Back Kinect Data. First, I recorded a rosbag file using

rosbag record camera/depth_registered/image_raw camera/depth_registered/camera_info camera/rgb/image_raw camera/rgb/camera_info --limit=60 -O kinectbag

As suggested in the tutorial, before playing back, I need to set the use_sim_time parameter. To do this, first I launch openni_launch without loading drivers

roslaunch openni_launch openni.launch load_driver:=false

Then, I set the parameter with

rosparam set /use_sim_time true

and confirmed that the parameter has indeed been set with the rosparam get /use_sim_time command (which returns true). I am trying to visualize the playback in rviz (added PointCloud2 to rviz with appropriate Fixed Frame and topic settings) using following playback command

rosbag play --clock --pause kinectbag.bag

At this point, the Status of PointCloud2 shows an error saying

Transform [sender=/camera/camera_nodelet_manager] Message removed because it is too old (frame=[/camera_rgb_optical_frame], stamp=[1442173625.519280128])

and a warning is printed on the terminal (from which I invoked rviz)

[ WARN] [1442177967.606387020, 1442173623.553857221]: Detected jump back in time. Clearing TF buffer.

I can see that prior to loading the rosbag play command, the ROS time in rviz is set to 0, and it changes to the timestamp of the first message in my rosbag recording after I issue the play command (hence, it is indeed using simulated time, and not wall time).

Can anyone point out what might be causing this error?

P.S: I know that hundreds of similar queries have been answered before here, but they all are resolved by setting the use_sim_time parameter. In my case, I am facing the issue in spite of doing that.


Originally posted by shobhit6993 on ROS Answers with karma: 161 on 2015-09-13

Post score: 6

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I finally got it to work. I guess the issue was that I was setting the use_sim_time parameter after the launch command, because of which the nodes (already launched) did not get the information that they are supposed to use the simulated clock.

One thing I would like to point out is that the tutorial indeed indeed asks you to set use_sim_time before the roslaunch command. When I initially tried to do this, I got the following error

ERROR: Unable to communicate with master!

because, obviously, the master was not running. I feel quite dumb now, but this is kind of what happens when you blindly follow the sequence mentioned in the tutorial, and not use common sense. The tutorial skips the instruction to first run roscore (to get the Master running). The roslaunch command itself starts the Master, if one is not running; but without setting the use_sim_time parameter to true.

In case someone falls into this silly pit in future, the following are the correct sequence of commands to get around this issue:

roscore

rosparam set /use_sim_time true

roslaunch openni_launch openni.launch load_driver:=false

rosrun rviz rviz (to launch rviz for visualization, or any other method to see the messages being played back)

rosbag play --clock --pause kinectbag.bag


Originally posted by shobhit6993 with karma: 161 on 2015-09-14

This answer was ACCEPTED on the original site

Post score: 9


Original comments

Comment by ahendrix on 2015-09-14:
Thanks for the answer! Please consider updating the tutorial with these extra steps as well.

Comment by shobhit6993 on 2015-09-15:
Done. This marks my first contribution to any wiki :)

Comment by ahendrix on 2015-09-15:
Thanks for the contribution!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.