bag-record

Synopsis

bag-record [OPTIONS] -o OUTPUT [URI1] [URI2 ...]

Description

The bag-record program can be used to capture certain RSB event s in a running system and store them into a log file for later analysis, further processing or replay.

See also

Common Commandline Options
The usual RSB-related commandline options are accepted.
Examples
The usual IDL-related commandline options are accepted.
--output-file OUTPUT, -o OUTPUT

Write captured events to file OUTPUT. The file format is determined based on the file type (which is determined based on the file extension).

Tip

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

--force

Should OUTPUT be overwritten in case it already exists?

--channel-allocation SPEC, -a SPEC

Allocate channels for received events in the output bag file according to the strategy designated by SPEC which has to be of the form:

KIND KEY1 VALUE1 KEY2 VALUE2 ...

where keys and values depend on KIND and are optional in most cases. The default channel allocation strategy is scope-and-type which creates on the fly based on events scopes and types according to the scheme SCOPE:TYPE.

Examples:

-a scope-and-type

Tip

Use the common --help-for channel-strategies or common --help-for all options to display the full help text, including available strategies and their respective parameters, for this item.

--flush-strategy SPEC

Flush buffers (e.g. event and indices) according strategy designated by SPEC which has to be of one of the forms:

KIND KEY1 VALUE1 KEY2 VALUE2 ...
OR (SPEC) (SPEC) ...
AND (SPEC) (SPEC) ...
NOT (SPEC)

where keys and values depend on KIND and are optional in most cases. The default flushing strategy is property-limit :property :length/bytes :limit 33554432 which corresponds to flushing buffers once they reach a size of 32 MB.

Examples:

--flush-strategy 'property-limit :property :length/bytes :limit 16777216'

Flush buffers once they reach a size of 16 MB.

--flush-strategy 'property-limit :property :length/entries :limit 100'

Flush buffers once they reach 100 entries.

--flush-strategy 'property-limit :property :time-to-last-write :limit 5'

Flush buffers when the most recent write was 5 or more seconds ago.

--flush-strategy 'or (:property-limit :property :time-to-last-write :limit 5)
                     (:property-limit :property :length/bytes :limit 33554432)'

Flush buffers when they reach a size of 32 MB or the most recent write was 5 or more seconds ago.

Tip

Use the common --help-for flush-strategies or common --help-for all options to display the full help text, including available strategies and their respective parameters, for this item.

--control-uri URI, -c URI

Expose an RPC interface for remote-controlling the recording process under URI. See Remote Control for details.

Important

Supplying this option causes bag-record to start in a suspended state. The recording has to be started using the :function:`start`.

Recording Events

Some general remarks regarding recording of RSB event s using bag-record:

  • The specified output file into which events should be recorded, should not already exist
    • If an empty file of the given name exists, it will be used for recording
    • If a non-empty file of the given name exists, it will be extended as long as it does not already contain any of the channels being recorded
  • The recording process can be terminated gracefully by sending one of SIGINT and SIGTERM to the bag-record process

Tip

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

Remote Control

bag-record can expose an RPC interface that allows starting, stopping and terminating the recording process. This feature is enabled using the --control-uri commandline option. An URI has to be supplied as an argument of the option to configure the scope and transport through which the RPC interface should be exposed. The interface consists of the following methods:

start()

Restart recording after it has been stopped.

stop()

Stop recording allowing it to be restarted later.

terminate()

Terminate the recording process and the program.

Examples

  • $ bag-record -o /tmp/nao.tide
                 'spread:/nao/vision/top?name=4803'
                 'spread:/nao/audio/all?name=4803'
                 'spread:/nao/proprioception?name=4803'
    

    The resulting file will (unless a different channel allocation is specified) contain one channel for each of the three RSB channel s.

  • $ bag-record -o /tmp/nao.tide
                 'spread://remote:4803/nao/vision/top'
                 'spread://remote:4803/nao/audio/all'
                 'spread://remote:4803/nao/proprioception'
    
  • $ bag-record -c 'spread:/control' -o /tmp/everything.tide spread:
    

    Then, without terminating the above bag-record process, the RPC Call program can be used to issue commands:

    $ call 'spread:/control/terminate()'