Constraints
A constraint is a spatial, temporal, or semantic relation between any two components. In the context of interpreting plexes as a multigraph of relationships over our system (comprised of different components), constraints are the edge-relationships of the graph.
Conventions
From and To, To and From
Constraints are always across two components. MetriCal will often refer to each of these components in a directional sense using the "from" and "to" specifiers, which reference the UUIDs of the components.
This directional specifier is useful for spatial and temporal constraints, because it allows us to know how the extrinsics from the spatial constraints, or the synchronization data from the temporal constraints can be applied to data to put two observations into the same frame of reference.
Our extrinsics type is essentially a way to describe how to transform points in one coordinate
system into another. Anyone who has ever worked with transforms has experienced confusion in
convention. In order to cut through the ambiguity of extrinsics, every spatial constraint has a
from
and to
field. Let's dive into how this works.
We can think of an extrinsics transform between components and using the following notation:
If we wanted to move a point from the frame of reference of component to that of , we would use the following math:
...also read as " equals by transforming to from ".
Thus, when constructing a spatial constraint, the reference frame for the extrinsics transform is in the coordinate frame of component , and would move points from the coordinate frame of component .
Similar examples can be made for converting timestamps from e.g. into the same "clock" as using temporal constraints.
Spatial Constraints
It is common to ask for the spatial relationship or extrinsics between two given components. A Plex incorporates this information in the form of what is called spatial constraints. A spatial constraint can be broken down into:
Field | Type | Description |
---|---|---|
Extrinsics | An extrinsics object | The extrinsics describing the "To" from "From" transformation. |
Covariance | A matrix of floats | The 6×6 covariance of the extrinsics described by this constraint. |
From | UUID | The UUID of the component that describes the "From" or base coordinate frame. |
To | UUID | The UUID of the component that describes the "To" coordinate frame, which we are transforming into. This can be considered the "origin" of the extrinsics matrix |
Spatial Covariance
Spatial covariance is generally presented as a 6×6 matrix relating the variance-covariance of an se3 lie group:
When traversing for spatial constraints within the Plex, the constraint returned will always contain the extrinsic with the minimum overall covariance. This ensures that users will always get the extrinsic that has the smallest covariance (thus, the highest confidence / precision), even if multiple spatial constraints exist between any two components.
Temporal Constraints
Time is a tricky thing in perception, but of crucial importance to get right. We've developed our temporal constraint to be flexible enough to describe many of the most common timing scenarios between components.
Field | Type | Description |
---|---|---|
Synchronization | A synchronization object | The strategy to achieve known synchronization between these two components in the Plex. |
Resolution | float | The resolution to which synchronization should be applied. |
From | UUID | The UUID of the component that the synchronization strategy must be applied to. |
To | UUID | The UUID of the component whose clock we synchronize into by applying our synchronization strategy (to the from component). |
The Problem With Clocks
In the world of hardware, measuring time can be a challenge. Two clocks might differ in several different ways; without taking these nuances into account, many higher-level perception tasks can fail.
Let's take the example below: two different clocks, possibly from two different hosts, that might be informing separate components in our plex.
Temporal constraints can balance these different clocks across a plex in order to make sure time confusion never occurs. It achieves this through Synchronization.
Synchronization
Synchronization describes the following relationship between two clocks:
Field | Type | Description |
---|---|---|
offset | Integer | The epoch offset between two clocks, in units of integer nanoseconds. |
skew | Integer | The scale offset between two clocks. Unitless. |
Offset
Unless two components are using the same clock, there's a chance that they are offset in time. This
means that time t in one clock does not align with time t in the other. Fixing this is rather
simple: just shift the time values in the from
clock by the offset
parameter until their two t
times match.