pyrcf.utils.frame_transforms
Utility functions to help with coordinate frame transforms.
Attributes
Numpy array representating quaternion in format [x,y,z,w] |
|
Numpy array representating 3D cartesian vector in format [x,y,z] |
Classes
Transform a pose (point and orientation) between PyRCF coordinate frames. |
Functions
|
Transform a pose from a global frame to a local frame. |
|
Transform a twist screw (linear velocity & angular velocity) to another coordinate frame. |
|
Given two frame poses in the same coordinate frame, return the pose of |
Module Contents
- pyrcf.utils.frame_transforms.QuatType: TypeAlias = np.ndarray
Numpy array representating quaternion in format [x,y,z,w]
- pyrcf.utils.frame_transforms.Vector3D: TypeAlias = np.ndarray
Numpy array representating 3D cartesian vector in format [x,y,z]
- pyrcf.utils.frame_transforms.transform_pose_to_frame(pos_in_frame_1: Vector3D, quat_in_frame_1: QuatType, frame_2_pos_in_frame_1: Vector3D, frame_2_quat_in_frame_1: QuatType) Tuple[Vector3D, QuatType]
Transform a pose from a global frame to a local frame.
Both the input pose and the local frame’s pose should be described in a common global frame.
- Parameters:
pos_in_frame_1 (Vector3D) – The position of the input pose object to be transformed in a common global frame.
quat_in_frame_1 (QuatType) – The orientation of the input pose object to be transformed in a common global frame (quaternion: [x,y,z,w]).
frame_2_pos_in_frame_1 (Vector3D) – Position of the origin of the target coordinate frame with respect to the common global frame.
frame_2_quat_in_frame_1 (QuatType) – The orientation of the target frame in the global frame.
- Returns:
- Position and orientation of the input pose in the new target
frame.
- Return type:
Tuple[Vector3D, QuatType]
- pyrcf.utils.frame_transforms.twist_transform(twist_a: numpy.ndarray, frame_b_in_a: numpy.ndarray) numpy.ndarray
Transform a twist screw (linear velocity & angular velocity) to another coordinate frame.
- Parameters:
twist_a (np.ndarray) – 6D twist screw (linear x, linear y, linear z, angular x, angular y, angular z)
frame_b_in_a (np.ndarray) – Transformation matrix of the pose of the new frame in the old frame.
- Returns:
- Twist screw in the new frame (linear x, linear y, linear z, angular x,
angular y, angular z).
- Return type:
np.ndarray
- pyrcf.utils.frame_transforms.get_relative_pose_between_vectors(pos1: Vector3D, quat1: QuatType, pos2: Vector3D, quat2: QuatType) Tuple[Vector3D, QuatType]
Given two frame poses in the same coordinate frame, return the pose of the second frame with respect to the first.
- Parameters:
pos1 (Vector3D) – Position of the first frame in a global frame.
quat1 (QuatType) – Orientation quaternion of the first frame.
pos2 (Vector3D) – Position of the second frame in the same global frame.
quat2 (QuatType) – Orientation of the second frame.
- Returns:
- Position and orientation of the second frame
with respect to the first.
- Return type:
Tuple[Vector3D, QuatType]
- class pyrcf.utils.frame_transforms.PoseTrasfrom
Transform a pose (point and orientation) between PyRCF coordinate frames.
- static TELEOP_FRAME_POSE_IN_WORLD(base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
This is the definition of the teleop frame.
- static BASE_FRAME_POSE_IN_TELEOP(base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
This is the definition of the teleop frame.
- static teleop2base(p_in_teleop: Vector3D, q_in_teleop: QuatType, base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
Transform a pose in teleop frame to base frame.
- static base2teleop(p_in_base: Vector3D, q_in_base: QuatType, base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
Transform a pose in base frame to teleop frame.
- static teleop2world(p_in_teleop: Vector3D, q_in_teleop: QuatType, base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
Transform a pose in teleop frame to world frame.
- static world2teleop(p_in_world: Vector3D, q_in_world: QuatType, base_pos_in_world: Vector3D, base_ori_in_world: QuatType) Tuple[Vector3D, QuatType]
Transform a pose in world frame to teleop frame.