bag-play [OPTIONS] LOGFILE [URI]
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.
The usual RSB-related commandline options and replay-related options are accepted.
To play all recorded events of a log file on their original channels, two commandline arguments have to be specified:
For details regarding the URI syntax involved in transport and channel specifications, see URIs.
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 commandline option can be used to select channels 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, --end-index, --start-time and --end-time commandline options allow specifying these restrictions.
Different strategies for controlling the replay timing can be used. Strategies and their parameters are specified using the --replay-strategy commandline option. The default replay strategy tries to mimic the original timing.
Other strategies include
In addition, some strategies permit modification of their behavior via parameters. For example
-r 'fixed-rate :rate 20'
-r 'recorded-timing :speed 1.5'
Tip
Available strategies and their parameters are described in the output of bag-play --help.
bag-play can expose an RPC interface that allows navigating the bag file being played back and controlling emission of events. An URI has to be supplied as the :uri argument of the --replay-strategy option to configure the scope and transport through which the RPC interface should be exposed. The full syntax of the commandline option therefore is
-r 'remote-controlled :uri "URI"'
The interface consists of the following methods:
Return the length of the replayed sequence as uint64.
Return the current position in the replayed sequence as uint64.
Move the replay cursor to the next entry, return new index as uint64.
Move the replay cursor to the previous entry, return new index as uint64.
Position the replay cursor at the supplied entry index.
Publish the entry at which the replay cursor is currently positioned.
Publish the entry at which the replay cursor is currently positioned, advance to the next entry, return new index as uint64.
Terminate the replay.
$ bag-play /tmp/nao.tide 'spread://remote:4803'
In the above 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 -c 'vision' -c 'audio' /tmp/nao.tide 'spread:?name=5555'
The above command plays all channels of the log file /tmp/nao.tide whose names match one of the regular expressions vision and audio.
$ bag-play --start-index 1000 /tmp/nao.tide 'spread:?name=5555'
The above command replays the events of the log file /tmp/nao.tide starting with the 1000-th event.