PoseTrajectory
positions (N, 3) in metres, orientations (N, 4) xyzw, optional twist per sample.
Full docstring
Orientations are slerped between samples and normalised at construction. Velocities are expressed in the reference frame (`header.frame_id`).
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() |
child_frame_id | str | '' |
positions per sample | Array | required |
orientations per sample | Array | required |
linear_velocities per sample | Array | None | None |
angular_velocities per sample | Array | None | None |
Example
One instance from the package's own test catalog; the output is its real repr().
PoseTrajectory(N=3, t=[0 … 1] s, header=Header(stamp=0.0, frame_id='base_link'), child_frame_id='tool0', positions=float64[3×3], orientations=float64[3×4], linear_velocities=float64[3×3], angular_velocities=float64[3×3])to_dict() as JSON
{
"_type": "trajectory/PoseTrajectory",
"t": {
"dtype": "<f8",
"shape": [3],
"data": [0.0, 0.5, 1.0]
},
"channels": {},
"header": {
"_type": "std/Header",
"stamp": 0.0,
"frame_id": "base_link",
"meta": {}
},
"child_frame_id": "tool0",
"positions": {
"dtype": "<f8",
"shape": [3, 3],
"data": [0.4, -0.1, 0.25, 0.4, -0.1, 0.14999999999999997, 0.4, -0.1, 0.25]
},
"orientations": {
"dtype": "<f8",
"shape": [3, 4],
"data": [-0.10566871683993562, 0.6991667342497077, 0.10566871683993563, 0.6991667342497078, -0.035340609509366974, 0.7062230818371108, 0.17494101728127348, 0.6851245437674769, -0.10566871683993562, 0.6991667342497077, 0.10566871683993563, 0.6991667342497078]
},
"linear_velocities": {
"dtype": "<f8",
"shape": [3, 3],
"data": [-1.1102230246251565e-16, 2.7755575615628914e-17, -0.40000000000000013, 0.0, 0.0, 0.0, 0.0, 0.0, 0.40000000000000013]
},
"angular_velocities": {
"dtype": "<f8",
"shape": [3, 3],
"data": [0.3821345956502424, 0.11820808266453608, -5.560377786892211e-17, 2.7755575615628914e-17, 6.938893903907228e-17, 0.0, -0.3821345956502423, -0.11820808266453595, 5.560377786892211e-17]
}
}Long arrays are cut after 16 values and say so with “…”.
Functions
Constructors
Classmethods and staticmethods: ways to build one.
from_matrices(
t: Sequence[float],
matrices: np.ndarray,
**static: object,
) -> PoseTrajectoryFrom (N, 4, 4) homogeneous transforms (what FK usually returns).
from_poses(
t: Sequence[float],
poses: Sequence[Pose],
**static: object,
) -> PoseTrajectoryNo docstring.
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.
dt: floatThe fixed sample step. Raises on a non-uniform trajectory rather than guess.
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.
rotated(
roll: float = 0.0,
pitch: float = 0.0,
yaw: float = 0.0,
local: bool = False,
) -> PoseTrajectoryEvery pose turned in place by ROS RPY, about the reference axes or its own.
shifted(
dx: float = 0.0,
dy: float = 0.0,
dz: float = 0.0,
local: bool = False,
) -> PoseTrajectoryEvery pose moved by (dx, dy, dz): along the reference axes, or along each pose's
transformed(
transform: Transform | Pose,
frame_id: str | None = None,
) -> PoseTrajectoryRe-express in another frame: T_new_child = transform @ T_old_child.
with_derivatives(*, overwrite: bool = False) -> PoseTrajectoryFill missing linear/angular velocity by finite differences on the real time grid.
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.
rebased() -> TrajectoryTSame trajectory with t[0] == 0; the offset moves into header.stamp.
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_dict
from Msgto_dict() -> dict[str, Any]JSON-safe dict with a "_type" key; arrays keep their dtype and shape.
to_points() -> tuple[TrajectoryPoint, ...]Array-of-structs view (what ROS puts on the wire).
window(start: float, end: float) -> TrajectoryTSamples with start <= t <= end, as a view.
Operators
Python operators and protocols the type supports.
__getitem__(key: Any) -> Anystr → a field's array · int → a point · slice, mask, indices → a trajectory.