vllm_omni.diffusion.models.gr00t.dataio.state_action.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
homogeneous property ¶
homogeneous: ndarray
Get homogeneous transformation matrix.
Returns:
| Type | Description |
|---|---|
ndarray | Homogeneous matrix - shape (4, 4) |
rot6d property ¶
rot6d: ndarray
Get rotation as 6D representation (first two rows of rotation matrix)
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 |
|
ndarray |
|
ndarray |
|
ndarray |
|
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]
Pose ¶
Abstract base class for robot poses.
This class provides common functionality for different pose representations including relative pose computation via the subtraction operator.
QuatOrder ¶
invert_transformation ¶
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 |