Poses
The Pose type: build a rigid transform, combine and invert poses, offset them along world or local axes, and interpolate.
A Pose is a rigid transform: a position in metres and an orientation. Poses are immutable; every operation returns a new one. Anchors, object poses and the tool pose all come back as Pose values, and every function that takes a pose also takes an Anchor or a 4x4 matrix.
Building a pose
p = Pose((0.40, -0.20, 0.10), (1.0, 0.0, 0.0, 0.0)) # xyz, quaternion wxyz
q = Pose.from_rpy((0.40, -0.20, 0.10), (3.14159, 0.0, 0.0)) # xyz, roll-pitch-yaw (rad)
m = Pose.from_matrix(T) # a 4x4 array
i = Pose.identity()Roll-pitch-yaw is extrinsic x-y-z. A quaternion with zero length raises ValueError; a quaternion is normalised otherwise.
Reading a pose
| Attribute | Value |
|---|---|
p.xyz | position, 3 values (m) |
p.wxyz | orientation quaternion, scalar first |
p.rpy | orientation as roll, pitch, yaw (rad) |
p.rotation | 3x3 rotation matrix |
p.matrix | 4x4 transform; numpy.asarray(p) gives the same |
Combining poses
| Expression | Result |
|---|---|
a @ b | b expressed in a's frame, composed (matrix product) |
a.inverse() | the inverse transform |
a.translated((dx, dy, dz), frame="world") | moved along the world axes |
a.translated((dx, dy, dz), frame="local") | moved along its own axes |
a.rotated(R, frame="local") | turned about its own origin; R is a 3x3 matrix or a rotation vector (rad); frame="world" turns about the world axes |
a.lerp(b, t) | position interpolated linearly, orientation by slerp; t from 0 (a) to 1 (b) |
a.with_xyz(xyz) | this orientation at another position (a position, or a pose whose position is taken) |
a.with_rotation(b) | this position with b's orientation |
a.distance(b) | metres between the two positions |
a.angle(b) | radians between the two orientations |
A worked example: placing a held object
While an arm holds an object, the transform from the tool to the object is fixed. The tool pose that puts the object's bottom_center anchor on a seat follows from it. This is how the starter's move_plate places a plate:
grip = get_tcp_pose(ARM).inverse() @ get_anchor_pose(plate_id, "bottom_center") # tool -> plate bottom
seat = dest.pose @ grip.inverse() # the tool pose that puts the plate bottom on dest
above = seat.translated((0.0, 0.0, 0.10), frame="world")Literal helpers
deg(x) returns radians and mm(x) returns metres. Import them by name: from execution.skill_api import deg, mm.
Updated 9 days ago