Trajectory
Samples at strictly increasing times t (seconds after header.stamp).
Full docstring
A bare `Trajectory` is just `t` plus `channels` — enough for any time series. Domain trajectories (`JointTrajectory`, `PoseTrajectory`, your own) subclass it and declare typed per-sample fields with `sample()`; they inherit everything below.
Preview
The figure robot_msgs.viz.plot(example) draws for the example below.

Fields
| Name | Type | Default |
|---|---|---|
t | Array | required |
channels | Mapping[str, Array] | {} |
header | Header | Header() |
Example
One instance from the package's own test catalog; the output is its real repr().
Trajectory(N=3, t=[0 … 0.2] s, channels={'temperature': [20. , 20.5, 21. ]})to_dict() as JSON
{
"_type": "trajectory/Trajectory",
"t": {
"dtype": "<f8",
"shape": [3],
"data": [0.0, 0.1, 0.2]
},
"channels": {
"temperature": {
"dtype": "<f8",
"shape": [3],
"data": [20.0, 20.5, 21.0]
}
},
"header": {
"_type": "std/Header",
"stamp": 0.0,
"frame_id": "",
"meta": {}
}
}Long arrays are cut after 16 values and say so with “…”.
Functions
Constructors
Classmethods and staticmethods: ways to build one.
from_points(
points: Sequence[TrajectoryPoint],
**static: Any,
) -> TrajectoryTStack points back into one trajectory; static sets the per-trajectory fields.
from_samples(
t: Any,
duplicate_times: DuplicateTimes,
**fields: Any,
) -> tuple[TrajectoryT, TimeRepair]Build from recorded samples whose stamps may repeat or step back; say what changed.
Properties
Read-only views computed from the fields.
sample_names: tuple[str, ...]Names of every per-sample array that is set: typed fields, then channels.
Methods
Return new values; messages are never mutated.
at(
time: float,
extrapolate: Extrapolation = 'raise',
) -> TrajectoryPointThe point at time, interpolated per field (sample(interp=...)).
is_uniform(rtol: float = 1e-06) -> boolTrue when every sample step equals the mean step within rtol.
resample(
times: Any = None,
dt: float | None = None,
extrapolate: Extrapolation = 'raise',
) -> TrajectoryTThe trajectory at new times, or on a fixed dt grid from start_time.
time_shifted(seconds: float) -> TrajectoryTEvery sample seconds later (earlier if negative).
to_points() -> tuple[TrajectoryPoint, ...]Array-of-structs view (what ROS puts on the wire).
to_dict
from Msgto_dict() -> dict[str, Any]JSON-safe dict with a "_type" key; arrays keep their dtype and shape.
Operators
Python operators and protocols the type supports.
__getitem__(key: Any) -> Anystr → a field's array · int → a point · slice, mask, indices → a trajectory.