Does "rosbag record -j" do its compression in the background after ROS shutdown?

asked 2016-03-25 13:30:03 -0600

joq gravatar image

updated 2016-03-28 08:28:24 -0600

I have a Python node that invokes rosbag record -j to record some topics.

  • On shutdown, rosbag returns.

  • At that point I want to run a script that uploads the bag from the robot to a server. That will take a while, and I don't want to delay shutdown so long.

  • The node, which is now shutting down, runs the script in the background under a different process group using the Linux setsid command (link to code).

  • Even when I run the script that way, it sometimes stops immediately without copying the expected bag file, which is expected to match $prefix_*.bag. Running the same command afterwards by hand works fine.

  • Delaying the script from starting seems to make it work more often. The length of delay needed appears to increase with the size of the bag.

So, I wonder if rosbag record -j is running its compression step in the background after ROS shutdown causes it to return. That would explain what I see: the $prefix_*.bag file does not exist until compression finishes.

edit retag flag offensive close merge delete

Comments

I tried to figure this out by looking at the source code, but could not find all the relevant pieces.

joq gravatar imagejoq ( 2016-03-25 13:32:23 -0600 )edit