Skip to content

vllm_omni.diffusion.models.gr00t.dataio.state_action.pose

PoseT module-attribute

PoseT = TypeVar('PoseT', bound='Pose')

EndEffectorPose

Bases: Pose

Represents a single end-effector pose with translation and rotation components.

This class handles Cartesian space representations of robot end-effector poses, supporting multiple rotation representations (quaternions, Euler angles, rotation vectors, rotation matrices, etc.).

Examples:

Create with quaternion (wxyz order)

pose = EndEffectorPose( translation=[1.0, 2.0, 3.0], rotation=[1.0, 0.0, 0.0, 0.0], rotation_type="quat", rotation_order="wxyz" )

Create with Euler angles (degrees by default)

pose = EndEffectorPose( translation=[1, 2, 3], rotation=[0, 0, 90], rotation_type="euler", rotation_order="xyz" )

Create with Euler angles in radians

pose = EndEffectorPose( translation=[1, 2, 3], rotation=[0, 0, np.pi/2], rotation_type="euler", rotation_order="xyz", degrees=False )

Create from homogeneous matrix

H = np.eye(4) H[:3, 3] = [1, 2, 3] pose = EndEffectorPose(homogeneous=H)

Convert between representations

quat_wxyz = pose.to_rotation("quat", "wxyz") euler_zyx = pose.to_rotation("euler", "zyx") rot6d = pose.to_rotation("rot6d")

Compute relative transformation

pose1 = EndEffectorPose(translation=[1, 0, 0], rotation=[1,0,0,0], rotation_type="quat", rotation_order="wxyz") pose2 = EndEffectorPose(translation=[2, 0, 0], rotation=[1,0,0,0], rotation_type="quat", rotation_order="wxyz") relative = pose2 - pose1 # Transformation from pose1's frame to pose2's frame

euler_xyz property

euler_xyz: ndarray

Get rotation as Euler angles in xyz order (degrees)

homogeneous property

homogeneous: ndarray

Get homogeneous transformation matrix.

Returns:

Type Description
ndarray

Homogeneous matrix - shape (4, 4)

pose_type class-attribute instance-attribute

pose_type = 'end_effector'

quat_wxyz property

quat_wxyz: ndarray

Get rotation as quaternion in wxyz order (w, x, y, z)

quat_xyzw property

quat_xyzw: ndarray

Get rotation as quaternion in xyzw order (x, y, z, w)

rot6d property

rot6d: ndarray

Get rotation as 6D representation (first two rows of rotation matrix)

rotation_matrix property

rotation_matrix: ndarray

Get rotation as 3x3 rotation matrix

rotvec property

rotvec: ndarray

Get rotation as rotation vector (axis-angle)

translation property

translation: ndarray

Get translation vector.

Returns:

Type Description
ndarray

Translation array - shape (3,)

xyz_rot6d property

xyz_rot6d: ndarray

Get pose as concatenated translation and 6D rotation (9,)

xyz_rotvec property

xyz_rotvec: ndarray

Get pose as concatenated translation and rotation vector (6,)

copy

copy() -> EndEffectorPose

Create a deep copy of this end-effector pose.

Returns:

Type Description
EndEffectorPose

New EndEffectorPose instance with copied data

from_action_format classmethod

from_action_format(
    data: ndarray, action_format: ActionFormat
) -> EndEffectorPose

Create an EndEffectorPose from a flat array using the specified action format.

This is the inverse of the xyz_rot6d / xyz_rotvec / homogeneous properties.

Parameters:

Name Type Description Default
data ndarray

Flat array whose layout depends on action_format.

required
action_format ActionFormat

One of ActionFormat.XYZ_ROT6D, XYZ_ROTVEC, or DEFAULT.

required

Returns:

Type Description
EndEffectorPose

EndEffectorPose instance.

set_rotation

set_rotation(
    rotation: list | ndarray,
    rotation_type: str,
    rotation_order: str | None = None,
    degrees: bool = True,
)

Set rotation from specified representation.

Parameters:

Name Type Description Default
rotation list | ndarray

Rotation data

required
rotation_type str

Type of rotation ("quat", "euler", "rotvec", "matrix", "rot6d")

required
rotation_order str | None

Order/convention for the rotation type

None
degrees bool

For Euler angles, whether the input is in degrees (default True)

True

to_homogeneous

to_homogeneous() -> ndarray

Convert pose to homogeneous transformation matrix. (Alias for the homogeneous property)

Returns:

Type Description
ndarray

Homogeneous matrix - shape (4, 4)

to_rotation

to_rotation(
    rotation_type: str,
    rotation_order: str | None = None,
    degrees: bool = True,
) -> ndarray

Get rotation in specified representation.

Parameters:

Name Type Description Default
rotation_type str

Desired type ("quat", "euler", "rotvec", "matrix", "rot6d")

required
rotation_order str | None

Order/convention for the rotation type

None
degrees bool

For Euler angles, return in degrees (default True)

True

Returns:

Type Description
ndarray

Rotation in requested format

ndarray
  • Shape (4,) for quat
ndarray
  • Shape (3,) for euler/rotvec
ndarray
  • Shape (6,) for rot6d
ndarray
  • Shape (3, 3) for matrix

EulerOrder

Bases: Enum

Common Euler angle conventions

XYZ class-attribute instance-attribute

XYZ = 'xyz'

XZY class-attribute instance-attribute

XZY = 'xzy'

YXZ class-attribute instance-attribute

YXZ = 'yxz'

YZX class-attribute instance-attribute

YZX = 'yzx'

ZXY class-attribute instance-attribute

ZXY = 'zxy'

ZYX class-attribute instance-attribute

ZYX = 'zyx'

JointPose

Bases: Pose

Represents a robot configuration in joint space.

This class stores joint angles/positions for a robot manipulator. Unlike end-effector poses, joint poses represent the configuration of all joints in the kinematic chain.

Examples:

Create a 6-DOF joint configuration

joint_pose = JointPose( joints=[0.0, -np.pi/4, np.pi/2, 0.0, np.pi/4, 0.0], joint_names=["shoulder_pan", "shoulder_lift", "elbow", "wrist_1", "wrist_2", "wrist_3"] )

Create with default joint names

joint_pose = JointPose(joints=[0.0, 0.5, 1.0])

Get as dictionary

joint_dict = joint_pose.to_dict() # {"joint_0": 0.0, ...}

Access individual joints

first_joint = joint_pose.joints[0] num_joints = joint_pose.num_joints

Compute relative joint displacement

joint1 = JointPose([0.0, 0.5, 1.0]) joint2 = JointPose([0.1, 0.6, 1.2]) relative = joint2 - joint1 # [0.1, 0.1, 0.2]

joint_names instance-attribute

joint_names = [
    f"joint_{i}" for i in (range(len(self.joints)))
]

joints instance-attribute

joints = np.array(joints, dtype=np.float64)

num_joints property

num_joints: int

Get the number of joints.

Returns:

Type Description
int

Number of joints in the configuration

pose_type class-attribute instance-attribute

pose_type = 'joint'

copy

copy() -> JointPose

Create a deep copy of this joint pose.

Returns:

Type Description
JointPose

New JointPose instance with copied data

to_dict

to_dict() -> dict

Convert joint configuration to dictionary.

Returns:

Type Description
dict

Dictionary mapping joint names to joint values

Pose

Abstract base class for robot poses.

This class provides common functionality for different pose representations including relative pose computation via the subtraction operator.

pose_type instance-attribute

pose_type: str

copy

copy() -> PoseT

Create a deep copy of this pose. Must be implemented by subclasses.

Returns:

Type Description
PoseT

New Pose instance with copied data

QuatOrder

Bases: Enum

Quaternion ordering conventions

WXYZ class-attribute instance-attribute

WXYZ = 'wxyz'

XYZW class-attribute instance-attribute

XYZW = 'xyzw'

RotationType

Bases: Enum

Supported rotation representation types

EULER class-attribute instance-attribute

EULER = 'euler'

MATRIX class-attribute instance-attribute

MATRIX = 'matrix'

QUAT class-attribute instance-attribute

QUAT = 'quat'

ROT6D class-attribute instance-attribute

ROT6D = 'rot6d'

ROTVEC class-attribute instance-attribute

ROTVEC = 'rotvec'

invert_transformation

invert_transformation(
    transform: NDArray[float64],
) -> NDArray[float64]

Invert a homogeneous transformation matrix.

Parameters:

Name Type Description Default
transform NDArray[float64]

A 4x4 homogeneous transformation matrix

required

Returns:

Type Description
NDArray[float64]

The inverse of the transformation matrix (4x4)

relative_transformation

relative_transformation(
    base_transform: NDArray[float64],
    target_transform: NDArray[float64],
) -> NDArray[float64]

Compute the relative transformation between two poses.

Parameters:

Name Type Description Default
base_transform NDArray[float64]

Initial 4x4 homogeneous transformation matrix

required
target_transform NDArray[float64]

Current 4x4 homogeneous transformation matrix

required

Returns:

Type Description
NDArray[float64]

The relative transformation matrix (4x4) from base_transform to target_transform