mirror of
https://github.com/aurora-opensource/xviz.git
synced 2026-01-18 14:07:46 +00:00
2.2 KiB
2.2 KiB
StreamSynchronizer
The StreamSynchronizer class looks into a
XVIZStreamBuffer and retrieves the most relevant datum
from each stream that "matches" the current timestamp.
import {XVIZStreamBuffer, StreamSynchronizer} from '@xviz/parser';
const streamBuffer = XVIZStreamBuffer();
const synchronizer = new StreamSynchronizer(streamBuffer);
// Load timeslices
streamBuffer.insert(...);
synchronizer.setTime(1000);
const frame = synchronizer.getCurrentFrame();
Constructor
new StreamSynchronizer(streamBuffer);
Parameters:
- streamBuffer (XVIZStreamBuffer) - a XVIZStreamBuffer instance.
- options (Object)
- postProcessFrame (Function) - callback to process the current frame before it is used.
Methods
setTime(timestamp)
Set the current timestamp.
Parameters:
- timestamp (Number)
getCurrentFrame(streamFilter)
Get a full descriptor of the log at the current timestamp.
Parameters:
- streamFilter (Object, optional) - a stream name to boolean map that indicates whether a stream
should be included. If
null, all streams are included.
Returns an object with the following fields:
- vehiclePose (Object) - the current vehicle pose.
- origin (Array) - map origin in
[lng, lat, alt] - vehicleRelativeTransform (Matrix4)
- trackPosition (Array) - vehicle position in
[lng, lat, alt] - heading (Number) - the heading of the vehicle
- features (Object) - a map from stream names to arrays of
geometry primitives. This is a subset of
streams. - lookAheads (Object) - a map from stream names to arrays of
futures. This is a subset of
streams. - variables (Object) - a map from stream names to
variables. This is a subset of
streams. - streams (Object) - the current state of all streams.
- objects (Object) - a map of XVIZObject instances that are in the current frame.