Log Reader Stage
The log reader stage allows you to playback data from a log into the system, as if that data was being generated live.
It is the primary driver of the system when executing log-based simulations.
Configuration
Pass in a standard LogReaderConfiguration
to the stage when you
are constructing it. This allows you to specify the URL to the log
you wish to play back.
Time Range
There are a few methods to determine the time range you want to
play back. You can either set to minimum_time
and maximum_time
values directly, which will clip your time range to those values,
or you can set maximum_playback_duration
, which will limit
playback to that duration.
Setting the duration configuration is a shortcut for saying “I want to playback 30 seconds of this log and I don’t want to calculate the time ranges myself”.
Shutdown Behavior
You can also determine if you want to shutdown the pipeline
at the end of the log by setting shutdown_on_playback_complete
.
This is the default for most log-based simulations.
Channel Playback
By default, channels are only loaded and played from the log in two conditions:
- if at least one stage in your pipeline subscribed to that channel
- if no stages in your pipeline publish concrete types on that channel
This boosts overall log reading performance, and reduces confusion in having multiple publishers of the same data. However, you may want to playback everything (possibly for debugging).
Set force_playback_all_messages
to true in that case.
Interacting
The log reader stage immediately begins playing back on startup.
You can control this with a few messages, which are defined in
the log_reader_controls.rbuf
file, and received over the
controls
channel.
The LogReaderCommand
message allows you to specify seeking
commands (either absolute or relative), along with a duration
that you wish to play for. See the file for more comments on
how to set those fields.
Metrics
The log reader stage periodically publishes two statistics structures:
LogReaderStageLogMetadata
, at 1Hz, onmetadata
LogReaderStageStatistics
, at 50Hz, onstatistics
The metadata structure contains information about the loaded log, including GUID, name, and time information.
The higher rate statistics structure contains the current time and an indication if you are playing or not. This higher rate message is used to send a minimal amount of data at a high frequency, to allow GUIs to update smoothly.