Data Playback
The DataPlayback module will allow you to play back .nbs
files as if they were happening in realtime. This can be very useful when you are trying to diagnose a problem for which you have a recording since you can continuously play back the same data.
The module will buffer up packets from the future and emit them at the same rate that they were emitted originally.
Usage
Add support::logging::DataPlayback
to your role file and comment out the roles that you want the nbs
files to replace. For example, if you are playing back message.input.Sensors
you need to comment out input::SensorFilter
from your role otherwise you will have two different modules emitting conflicting Sensors
messages. You must recompile your role for these changes to take effect.
In order to play back the messages you need to enable the message types that are the input to the modules that you wish to test by setting them to true in the configuration (e.g. message.input.Sensors: true
). Make sure the .nbs
file contains the messages you are trying to emit (you can check with ./b nbs stats <nbs-file>
).
nbs
files can be provided to the module via the configuration file or via the command line. If the configuration file has arguments those are used. If there are no files provided in the configuration file, the arguments from the command line are used instead. This is so that if you have another module in your role that relies on command line arguments you have an alternate way to provide these files.
If you provide files in the configuration file and files on the command line, only the files in the configuration will be played.
You can provide multiple .nbs
files and they will be played in sequence. For example, the following command will run a role and play back <nbs-file-a>
followed by <nbs-file-b>
./b run <role> recordings/<nbs-file-a> recordings/<nbs-file-b>
Notes
There is some weird behaviour that will occur when using this module that won't happen in a real system. Take note of these if they influence your usage
- If there are any timestamp fields in the messages, these will not be updated. If you are comparing the timestamps in the messages to the current time they will be wrong.
- When you are providing paths to
.nbs
files via a./b run
command they are relative to the build directory in docker. There is a symlink torecordings
that is placed there to make any nbs file inrecordings
easier to use. Outside of this path you will need to provide the full path from docker's perspective.
recordings
is a directory in the root folder of the NUbots repository.