Ask Your Question
0

Possible to record a specific time window (from T1 to T2) of a rosbag?

asked 2019-06-29 11:31:48 -0600

RayROS gravatar image

updated 2019-06-29 11:37:48 -0600

Hello, I am trying to understand if it is possible to record only a specific time window (from Time T1 to time T2) in a rosbag. The reason for this is that I need to print the result of specific topics into 2 different .csv files. According to the rosbag official documentation is possible to start recording from a specific point in time in the bag, and in fact that is what I am doing, but don't know how to set an end time:

<node pkg="rosbag" type="play" name="player" output="screen" args="--clock -q -s 2340 /home/toMyBag/test.bag"/>
<node pkg="rosbag" type="record" name="record" output="screen" args="-O filter_second_order_bis /estimate "/>
<node pkg="rosbag" type="record" name="record" output="screen" args="-O filter_second_order_bis /particle_cloud "/>

But is it possible to set a limit in the time recording?

From the example below, I need to record from approximately minute 39 to minute 224 (4h 4' 0" )approximately so:

Beginning of the recording : 39*60 = 2340 seconds

End of the recording: 224*60 = 13440 second

1

Thank for pointing in the right direction on this matter.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-06-29 12:42:12 -0600

You can specify a maximum duration for recording a rosbag using the --duration parameter as below:

rosbag record --duration=5m

In your case you could use a duration of 175m to achieve what you need. It's a bit clunky to have to specify the start time in the playback node and the duration in the recording node, but it will do the job.

You can also make the recording rosbag node required="true" so it shuts the whole launch file down automatically when it finishes.

Hope this helps.

edit flag offensive delete link more

Comments

@PeteBlackerThe3rd, thanks for reading my question. Yes that helps a lot. I think you are suggesting to do this: <node pkg="rosbag" type="play" name="player" output="screen" required="true" args="--clock --duration=13440 -q -s 2340 /home/emanuele/test.bag"/> I am not sure what you mean with 175m

RayROS gravatar imageRayROS ( 2019-06-29 14:29:10 -0600 )edit

Ok I know what you mean: <node pkg="rosbag" type="play" name="player" output="screen" args="--clock --duration=185m -q -s 2340 /home/emanuele/test.bag"/> Got it thanks! :)

RayROS gravatar imageRayROS ( 2019-06-29 15:27:10 -0600 )edit

The duration parameter needs to go into the recording rosbag, not the playing one.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2019-06-29 15:51:14 -0600 )edit

Thanks! I am posting below the complete answer if anyone needs:

The following instruction will start the bag from second (in my case) 2340 or (39 min) <node pkg="rosbag" type="play" name="player" output="screen" args="--clock -q -s 2340 /home/toYourBag/test.bag" /> The following instead will record the bag from the minute provided in the play for (in my case) 185 minutes <node pkg="rosbag" type="record" name="record" output="screen" args="--duration=185m -O filter_second_order_bis /estimate /particle_cloud " required ="true"/>

RayROS gravatar imageRayROS ( 2019-06-29 16:23:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-06-29 11:31:48 -0600

Seen: 46 times

Last updated: Jun 29