Replay API
The Replay API allows simulating real-time SDK behavior with previously recorded data, or rerunning recorded sequences with high-quality postprocessing settings, which is especially useful when used together with the Mapping API.
The replay API can be used with data recorded from any of the devices supported by the SDK.
- class spectacularAI.Replay(*args, **kwargs)
Replay previously recorded data
Overloaded function.
__init__(self: spectacularAI.Replay, folder: str, *, mapperCallback: Callable[[spectacularAI::mapping::MapperOutput], None] = None, configuration: dict = {}, ignoreFolderConfiguration: bool = False, startTime: object = None, stopTime: object = None) -> None
Build a replay from a given folder containing the dataset
__init__(self: spectacularAI.Replay, folder: str, mapperCallback: Callable[[spectacularAI::mapping::MapperOutput], None], *, configuration: dict = {}, ignoreFolderConfiguration: bool = False, startTime: object = None, stopTime: object = None) -> None
Build a replay from a given folder containing the dataset with a mapping callback
- close(self: spectacularAI.Replay) None
Closes replay.
- runReplay(self: spectacularAI.Replay) None
Starts replaying the data and blocks until close() is called or the entire session has played out
- setExtendedOutputCallback(self: spectacularAI.Replay, arg0: Callable[[spectacularAI.VioOutput, List[spectacularAI.Frame]], None]) None
Set a callback that’s called for new output
- setOutputCallback(self: spectacularAI.Replay, arg0: Callable[[spectacularAI.VioOutput], None]) None
Set a callback that’s called for new output
- setPlaybackSpeed(self: spectacularAI.Replay, arg0: float) None
Sets playbacks speed, 1.0 == real time, 2.0 == fast forward 2x, 0.5 == at half speed, -1.0 == unlimited. Defaults to 1.0.
- startReplay(self: spectacularAI.Replay) None
Starts replaying the data in the background until close() is called or entire session has been played.
Defined in #include <spectacularAI/replay.hpp>
-
namespace spectacularAI
Typedefs
-
using FrameSet = std::vector<std::shared_ptr<const Frame>>
-
struct Frame
-
struct Replay
Visual-Inertial Odometry API Replay
Public Functions
-
virtual ~Replay()
Destructor. Stops nay worker threads and frees other resources
-
virtual void startReplay() = 0
Starts replaying data in the background until replay is closed or entire session has been played.
-
virtual void runReplay() = 0
Starts replaying data and blocks until replay is closed or entire session has been played.
-
virtual bool replayOneLine() = 0
Plays a single line of data and returns false when there is no more data.
-
virtual void setPlaybackSpeed(double speed) = 0
Sets playbacks speed, 1.0 == real time, 2.0 == fast forward 2x, 0.5 == at half speed, -1.0 == unlimited. Defaults to 1.0.
-
virtual void setDryRun(bool isDryRun) = 0
If enabled, read and parse recorded data, but do not feed it to the algorithm. This is useful for performance measurements: a dry run can be used to estimate the data parsing time which does not happen in the real-time use case.
-
virtual void setOutputCallback(const std::function<void(VioOutputPtr)> &onOutput) = 0
Set output callback, called whenever new output is available.
The output remains valid as long as the shared pointer is alive. Can be passed to different threads and the last reference can be destructed in another thread. However, these should not be stored long term to avoid memory leaks.
Will be called fromt the same thread where gyroscope samples are added.
-
virtual void setExtendedOutputCallback(const std::function<void(VioOutputPtr, const FrameSet&)> &onOutput) = 0
Experimental!
-
virtual void close() = 0
Do not use this!
Public Static Functions
-
static Builder builder(const std::string &dataFolder, Vio::Builder vioBuilder)
Setup a Replay.
- Parameters:
dataFolder – Path to folder containing sensor data, and optionally calibration and VIO configuration.
vioBuilder – Vio builder. If Vio sets a calibration path, it will replace any calibration Replay reads from the data folder. If Vio sets a configuration, it will be appended to configuration Replay reads from the data folder, if any.
-
struct Builder
Public Functions
-
Builder setFfmpeg(bool enabled)
Optional. Set whether to use ffmpeg to read file or not. Default is true.
-
Builder setIgnoreFolderConfiguration(bool ignore)
Optional. Set whether to ignore vio_config.yaml in recording folder. Default is false.
-
Builder setStartTime(double time)
Start replay at this time, relative to the first frame timestamp. If not set, processing starts at the first input (which may be before the first frame).
-
Builder setStopTime(double time)
If set, stop replay at this time, relative to the first frame timestamp.
Public Members
-
std::shared_ptr<Data> _data
-
struct Data
Public Functions
-
virtual ~Data()
-
virtual ~Data()
-
Builder setFfmpeg(bool enabled)
-
virtual ~Replay()
-
using FrameSet = std::vector<std::shared_ptr<const Frame>>