Client API Tutorial

In addition to bag cat and bag play, RSBag provides a simple client API for working with log files. Analyzing, visualizing and transforming recorded data are the primary use-cases for this API.

Preparation

See also

Preparation
Installing RSBag

This section assumes a working installation of RSBag including at least one of the client APIs.

The RSBag client API for Python is provided by the rsbag module. To use the module

import rsbag

All subsequent listings assume this.

Not implemented yet
Not implemented yet
(ql:quickload '(:cl-rsbag :rsbag-tidelog))

Note

The client API presented here only takes care of making available the contents of log files, not the interpretation of this data. Depending on the kind of data, it may be necessary to load and/or register RSB converters to access the data in a convenient form. See Sending and Receiving Custom Data Types for details.

Opening A Log file

Processing data in log files starts with opening the respective log file.

Log files are opened using the rsbag.openBag() function. This function returns a Bag object implementing the context manager protocol:

1
2
3
with rsbag.openBag('/media/local_data/foo.tide',
                   channels = [ 'vision' ]) as bag:
    pass
Not implemented yet
Not implemented yet
(rsbag:with-bag (bag "/media/local_data/foo.tide" :direction :input)
   (rsbag:bag-channel bag "vision"))

Accessing Events

Events are accessed using the rsbag.Bag.events and rsbag.Bag.items properties. Both behave like ordinary Python sequences:

1
2
3
4
5
with rsbag.openBag('/media/local_data/foo.tide',
                   channels = [ 'vision' ]) as bag:
    print len(bag.events)
    for e in bag.events:
        print (e.scope, e.metaData.createTime, e.data.width, e.data.height)
Not implemented yet
Not implemented yet
(rsbag:with-bag (bag "/media/local_data/foo.tide" :direction :input)
   (values
     (length (rsbag:bag-channel bag "vision"))
     (subseq (rsbag:bag-channel bag "vision") 5 10)))