source_frame into target_frame.
Direction: a transform is the pose of the source frame, measured in the target
frame. Name it <source>_wrt_<target>: camera_wrt_base is
Transform(..., source_frame="camera", target_frame="base"), the transform that
Camera.getExtrinsics() returns as a 4x4 matrix. Its translation is the
camera origin in base coordinates, and its rotation is the camera axes
relative to the base axes.
Math: a point p in the source frame maps to p' = R p + t in the target
frame, where R is rotation and t is translation; with the 4x4
matrix M = to_matrix(), p' = M p. A Pose’s orientation q becomes
q_T * q. inverse() has rotation R^-1 and translation -R^-1 t, and
swaps the frames. transform.T is the transpose of the 4x4 matrix, as in
NumPy, for points stored as rows:
points @ transform.T. The transpose is not the inverse; use inverse().
Order: A @ B composes in matrix order, so B applies first; read a chain
from right to left. At each @, the right side must map into the frame that
the left side maps from: A.source_frame == B.target_frame.
Frame checks: T @ pose needs pose.frame_id == T.source_frame and returns
a Pose with frame_id == T.target_frame. A @ B needs
A.source_frame == B.target_frame. from_pose needs the pose in
target_frame. A mismatch raises FrameMismatchError, a ValueError
whose message names both frames. A Pose without a frame_id is taken to be
in the source frame and is not checked. Frames are names that the caller
supplies; nothing is inferred.
Fields
Position
The origin of the source frame in the target frame (meters).
Orientation
The orientation of the source frame in the target frame.
str
The frame that the transform maps from.
str
The frame that the transform maps to.
Constructor
Signature
required
The origin of the source frame in the target frame (meters).
required
The orientation of the source frame in the target frame.
required
The frame that the transform maps from.
required
The frame that the transform maps to.
Properties
np.ndarray
The transpose of the 4x4 matrix,
to_matrix().T, as in NumPy.Use it for points stored as rows: points @ transform.T maps an (N, 4)
array of homogeneous points. It is not the inverse; use inverse.Methods
apply()
Signature
source_frame into target_frame; the same as self @ pose.
A pose without a frame is taken to be in source_frame. The input pose does
not change.
required
The pose to map.
target_frame, with frame_id set to target_frame.
Raises:
FrameMismatchError: If the pose has a frame and it is not source_frame.
compose()
Signature
other first, then this transform; the same as self @ other.
required
A transform whose target frame is this transform’s source frame.
other.source_frame into self.target_frame.
Raises:
FrameMismatchError: If other.target_frame is not self.source_frame.
from_dict()
Signature
{"translation", "rotation", "source_frame", "target_frame"}
from_matrix()
Signature
required
4x4 rigid transform; the bottom row must be
[0, 0, 0, 1].required
The frame that the matrix maps from.
required
The frame that the matrix maps to.
from_pose()
Signature
pose.
required
The pose of the source frame in the target frame.
required
The frame located at
pose.required
The frame that
pose is in.source_frame into target_frame.
Raises:
FrameMismatchError: If the pose has a frame and it is not target_frame.
identity()
Signature
frame onto itself and changes no coordinates.
required
The source and target frame.
frame.
inverse()
Signature
target_frame into source_frame.
Returns:
Transform: The inverse transform, with the frames swapped.
to_dict()
Signature
{"translation", "rotation", "source_frame", "target_frame"}
to_matrix()
Signature