Especially when working with sound, we often estimate a 3D point together with a time. Event represents that space-time quantity as a timestamp paired with a three-dimensional location and provides a compact value type for spacetime and navigation geometry.
import gtsam
import numpy as npInitialization¶
Construct from a timestamp and a three-vector, or pass the three spatial coordinates separately.
event = gtsam.Event(2.5, np.array([1.0, -0.5, 3.0]))
same_event = gtsam.Event(2.5, 1.0, -0.5, 3.0)
print("time:", event.time())
print("location:", event.location())Accessors and height¶
time() and location() return the stored values. height() returns the z-coordinate and optionally computes its Jacobian with respect to the event coordinates in APIs that request derivatives.
print("height:", event.height())
assert np.isclose(event.height(), event.location()[2])
assert np.isclose(same_event.time(), event.time())
np.testing.assert_allclose(same_event.location(), event.location())Coordinate and time conventions¶
Event deliberately does not assign units or a reference frame. The location should use the same world frame as the surrounding geometry, and timestamps should use one consistent scale throughout a problem. The class also does not enforce chronological ordering; that belongs to the data structure or factor that consumes the events.