Rotation

Reference for the gtFrame.rotation module.

This module contains helper functions and classes to work with rotations. Mainly this is used for 2d-rotations as 3d-rotations are handled with scipy.

Module Contents

Classes:
  • Rotation2d

class gtFrame.rotation.Rotation2d(angle)

Describes a rotation in two-dimensional space.

Parameters:

angle (float) – the rotation angle from the reference direction [0, 0] expressed in radians

apply(vector)

Apply the rotation to a given 2d-vector.

Parameters:

vector (np.ndarray) – the vector as a numpy array

Returns:

the transformed vector as a numpy array

Return type:

np.ndarray

apply_inverse(vector)

Apply the inverse of the rotation. This reverts the rotation. I.e. it reverts the apply() method.

Parameters:

vector (np.ndarray) – the vector on which to apply the inverse rotation as a numpy array

Returns:

the transformed vector as a numpy array

Return type:

np.ndarray

as_degrees()

Returns the rotation as an angle expressed in degrees.

Returns:

the rotation as an angle expressed in degrees

Return type:

float

as_inverse()

Returns the rotation as the inverse of the rotation matrix.

Returns:

the inverse rotation matrix

Return type:

np.ndarray

as_matrix()

Returns the rotation as a rotation matrix (numpy array).

Returns:

the rotation as a rotation matrix

Return type:

numpy.ndarray

as_rad()

Returns the rotation as an angle expressed in radians.

Returns:

the rotation as an angle expressed in radians

Return type:

float

is_close(rotation, rtol=1e-09, atol=0.0)

Checks wether two gtFrame.rotation.Rotation2d objects are close.

Parameters:
  • rotation (Rotation2d) – the other rotation object

  • rtol (float) – relative tolerance

  • atol (float) – absolute tolerance

Returns:

Wether the two rotations are close.

Return type:

bool

update(angle)

Updates (changes) the rotation.

Parameters:

angle (float) – the new desired angle expressed in radians

Returns:

None

Return type:

None