Data logging

From The Player Project

Player supports logging data from sensors, and playing that data back at a later time. Support for these functions are provided by the writelog and readlog drivers. This page provides a basic overview of how to use these drivers to create and play back log files. More detailed information can be found at the data logging tutorial documentation page.

Player comes with example writelog and readlog drivers, you can find them at "$PREFIX/share/player/config/", where $PREFIX is the path to which Player was installed (usually "/usr/local" or "/usr")

Logging Data

In order to log data, you have to use the writelog driver. Writelog subscribes to the devices you specify, and records all data messages coming from the subscribed interfaces to a file. To accomplish this, you'll have to write a configuration file like one below:

As you can see, writelog subscribes to laser:0 provided by the sicklms200 driver, and position2d:0 provided by the p2os driver. All of the data published by sicklms200 and p2os is then recorded to a log file at "/home/user/logs/mydata_YYYY_MM_DD_HH_MM_SS.log". The writelog driver can read from several devices at a time, add as many devices as you want to the "requires" section. All of the data will be recorded to the same logfile.

The writelog driver also queries certain devices for geometry information when it starts. These values are stored at the beginning of the log file, and can be queried from readlog later.

Playing Back Data

To play data from a log file back, the readlog driver must be used. Readlog will read data from a logfile (created by writelog) and play it back through the appropriate interfaces. For example, say we used the above configuration file to record laser data from the sicklms200 device. Now we want to play the log back and have it act like the laser and position2d devices. To do so, we use a configuration file like the one below:

This driver will publish the data in the log file as though it were coming from real laser and position2d devices. To verify this, use utilities like playerprint or playerv and subscribe to the provided interfaces. The data should be displayed as though it were coming from the physical device the data was recorded from.

Parsing Logs Manually

Player's log files are stored as plain text files. You can open a log with your favorite text editor and see the data that is stored there. Log files all contain the following header information: