Adding Temporal Constraints

With the spatial constraints completed, we can turn our attention to our temporal constraints. These aid in timestamp synchronization between component observations.

There are two parts to temporal constraints: synchronization and resolution. The first, synchronization, tells the Platform how two component clocks are related. Since both of our components are using the same clock (because they share a host, or are part of the same sensor package, etc), we can leave these zeroed out. There is no synchronization needed; they're already the same!

let sync = Synchronization {
        // in nanoseconds  
        offset: 0,
        // unitless scale factor
        skew: 0,
# No offset or skew here
sync = plex.Synchronization(0, 0)
// No offset or skew here
tangviz::Synchronization sync{0, 0};

The second part is resolution. This tells the Platform how close together in time that observations from two components should be.

It's common for cameras to have a frame rate of 30fps, which translates into 33.333ms between every frame. This means that we can expect any other observations within 16.66ms of our initial observation to be part of the synced group.

Diagrams, please?

Resolution is tricky to explain with words. Pictures do a lot more; you can find them in the temporal constraints documentation.

With synchronization and resolution solved, we can build our temporal constraint:

let time = TemporalConstraint {
    synchronization: sync,
    // in nanoseconds
    resolution: 16.66e6,
    from: camera_b_uuid,
    to: camera_a_uuid,
# Convert resolution to nanoseconds
# Should equal out to 16666666ns (16.6~ ms)
c0_fps = 30
resolution = int(((1/c0_fps) / 2) * 1e9)
temporal_constraint = plex.TemporalConstraint(
    camera_b_uuid, resolution, sync, camera_a_uuid)
// Convert resolution to nanoseconds
// Should equal out to 16666666ns (16.6~ ms)
uint8_t c0_fps = 30;
int64_t resolution = uint64_t(((1 / c0_fps) / 2) * 1e9);
tangviz::TemporalConstraint temporal_constraint{camera_b_uuid, resolution,
                                                sync, camera_a_uuid};

Completed temporal constraint