bag-play

*The information on this page has been superseded by the RSBag Manual.*

Introduction

The bag-play program can be used to publish RSB events from a log file of recorded events. Replaying event flows as closely to the original as possible or with certain modifications can be very useful when debugging components, doing performance or regressions tests or testing the influence of parameters.

See bag-record for recording and bag-info for inspection of log files.

Obtaining bag-play

Binaries of the bag-play program can be downloaded from the continuous integration server for versions 0.4, 0.5 and the trunk version of the Robotics Service Bus:

After the download, the bag-play file has to be made executable in most cases. This can be done for example by executing

chmod +x bag-play

in the download directory.

Checking Versions and Displaying Help

Version and help information is displayed when the --version and --help[-for all] commandline options are specified:

./bag-play --version
./bag-play --help
./bag-play --help-for all

The output of --help[-for all] includes a list of supported file formats.

Playback of Previously Recorded Events

Playback of All Recorded Channels

To play all recorded events of a log file on their original channels, two commandline arguments have to be specified:
  1. The log file from which events should be read
  2. The "base" RSB scope to which events should be published
    In the following example, the specified scope is "/" which causes all events to be played on their original scopes since recorded event scopes are appended to the specified base scope
./bag-play /tmp/nao.tide 'spread://remote:4803'

For details regarding the URI syntax involved in transport and channel specifications, see URI Schema.

Selecting Channels for Playback

The default behavior of bag-play is to play back all channels found in the given file. However, when only a subset of the recorded channels should be played back, the --channel (-c) commandline option can be used to select channels for playback. The following example plays all channels matching one of the regular expressions "vision" and "audio".

./bag-play -c 'vision' -c 'audio' /tmp/nao.tide 'spread:?name=5555'

Selecting Temporal Intervals for Playback

The default behavior of bag-play is to play back all events of the selected channels ordered by timestamp, from earliest to latest. However, it is possible to select a subset of these events by specifying temporal or index-based intervals.

The
  • --start-index (-s)
  • --end-index (-e)
  • --start-time (-S)
  • --end-time (-E)

commandline options allow specifying these restrictions.

For example, to replay the events of a log file starting with the 1000-th event, the following command can be used:

./bag-play --start-index 1000 /tmp/nao.tide 'spread:?name=5555'

Controlling Replay Timing

Different strategies for controlling the replay timing can be used. Strategies and their parameters are specified using the --replay-strategy (-r) commandline option. The default replay strategy tries to mimic the original timing.

Other strategies include
  • Replay events as fast as possible
  • Replay events at a fixed rate

In addition, some strategies permit modification of their behavior via parameters. For example:

-r 'fixed-rate :rate 20'
-r 'recorded-timing :speed 1.5'

Available strategies and their parameters are described in the output of bag-play --help.