Coordinate System Transformations#
- class Direction#
Bases:
ndarray
A cartesian unit norm vector pointing towards a direction.
- classmethod From_Spherical(azimuth, zenith)#
Initialize a direction from spherical parameters.
- Parameters:
azimuth (float) – Azimuth angle in radians.
zenith (float) – Zenith angle in radians.
- Return type:
Returns: The initialized direction.
- to_spherical()#
Represent the direction as spherical coordinates.
Returns: An array representing azimuth and zenith angles in radians.
- Return type:
ndarray
- class Transformation#
Bases:
ndarray
,Serializable
Coordinate system transformation.
- yaml_tag: Optional[str] = 'Transformation'#
YAML serialization tag.
- property translation: ndarray#
- property rotation_rpy: ndarray#
Orientation in Roll, Pitch and Yaw Angles.
Returns: Roll, Pitch and Yaw in Radians.
- classmethod No()#
- Return type:
- classmethod From_RPY(rpy, pos)#
- Return type:
- classmethod From_Translation(translation)#
- Return type:
- transform_position(position)#
Transform a cartesian position.
- Parameters:
position (np.ndarray) – Numpy array representing the cartesian position.
- Return type:
ndarray
Returns: The transformed position.
- Raises:
ValueError – If position is invalid.
- rotate_direction(direction)#
Rotate a cartesian direction.
- Parameters:
direction (np.ndarray) – A directional vector.
- Return type:
Returns: The transformed direction.
- Raises:
ValueError – If direction is invalid.
- transform_direction(direction, normalize=False)#
Transform a direction.
- Parameters:
direction (np.ndarray) – Direction to be transformed.
normalize (bool, optional) – Normalize the resulting transformed direction to a unit norm vector. Disabled by default.
- Return type:
Returns: The transformed direction.
- classmethod to_yaml(representer, node)#
Serialize a serializable object to YAML.
- Parameters:
representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.
node (Serializable) – The channel instance to be serialized.
- Return type:
MappingNode
Returns: The serialized YAML node.
- classmethod from_yaml(constructor, node)#
Recall a new serializable class instance from YAML.
- Parameters:
constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.
node (Node) – YAML node representing the Serializable serialization.
- Return type:
Returns: The de-serialized object.
- class TransformableLink#
Bases:
object
Abstract base class of kinetmatic chain links.
- abstract property forwards_transformation: Transformation#
Transformation to convert local coordinates to global coordinates.
Updated every time the kinematic chain’s parameters change.
Returns: The transformation.
- abstract set_base(base)#
Set the relative base coordinate frame of this link.
- Parameters:
base (TransformableLink | None) – The base to be coordinate frame to be set. None to detach the link.
- Return type:
None
- property linked_frames: Set[TransformableLink]#
- add_link(link)#
Establish a new link to a coordinate frame depending on this frame.
- Parameters:
link (Transformable) – The transformable frame to be registered.
- Return type:
None
- remove_link(link, force_removal=True)#
Remove an established link to this coordinate frame.
- Parameters:
link (Transformable) – The coordinate frame to be linked to this frame.
force_removal (bool, optional) – Raise a RuntimeError if the link is not registered
- Raises:
RuntimeError – If the link is not currently registerd and force_removal is enabled.
- Return type:
None
- class TransformableBase#
Bases:
TransformableLink
Base of kinematic chains.
- property forwards_transformation: Transformation#
Transformation to convert local coordinates to global coordinates.
Updated every time the kinematic chain’s parameters change.
Returns: The transformation.
- set_base(base)#
Set the relative base coordinate frame of this link.
- Parameters:
base (TransformableLink | None) – The base to be coordinate frame to be set. None to detach the link.
- Return type:
None
- class Transformable(pose=None)#
Bases:
Serializable
,TransformableLink
Representation of a Coordinate Frame within a Kinematic Chain.
- Parameters:
pose (Transformation, optional) – Transformation of the transformable with respect to its reference frame. By default, no transformation is considered, i.e.
Transformation.No()
- property_blacklist: Set[str] = {'pose'}#
Set of properties to be ignored during serialization.
- property position: ndarray#
Position of the Transformable.
Cartesian offset to the reference coordinate frame.
- Returns:
Cartesian position x, y, z in m.
- Raises:
ValueError – If position is not a valid three-dimensional vector.
- property orientation: ndarray#
Orientation of the Transformable.
Returns: The transformation in radians for roll, pitch and yaw.
- Raises:
ValueError – If orientation is not a three-dimensional numpy vector.
- set_base(base)#
Set the relative base coordinate frame of this link.
- Parameters:
base (TransformableLink | None) – The base to be coordinate frame to be set. None to detach the link.
- Return type:
None
- property global_position: ndarray#
Position of the represented object within the global coordinate system.
Returns: Three-dimensional numpy vector representing the cartesian object coordinates.
- property global_orientation: ndarray#
Orientation of the represented object within the global coordinate system.
Returns: Three-dimensional numpy vector representing roll, pitch and yaw in radians.
- property is_base: bool#
Is this transformable acting as a base frame?
Returns: Boolean indicator.
- property pose: Transformation#
Pose of the Transformable with respect to its reference link.
Returns: The pose’s transformation.
- property forwards_transformation: Transformation#
Transformation to convert local coordinates to global coordinates.
Updated every time the kinematic chain’s parameters change.
Returns: The transformation.
- property backwards_transformation: Transformation#
Transformation to convert global coordinates to local coordinates.
Updated every time the kinematic chain’s parameters change.
Returns: The transformation.
- to_local_coordinates(arg_0, arg_1=None)#
- Return type: