spatial-casadi  1.1.0
Spatial transformation library for CasADi Python.
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
spatial_casadi.spatial.Rotation Class Reference

A class for representing spatial rotations. More...

Public Member Functions

def __init__ (self, ArrayType quat, bool normalize=True)
 Initializer for the Rotation class. More...
 
def __mul__ (self, other)
 Compose this rotation with the other. More...
 
def inv (self)
 Invert this rotation. More...
 
ArrayType as_quat (self, str seq="xyzw")
 Represent as quaternions. More...
 
ArrayType as_matrix (self)
 Represent as rotation matrix. More...
 
ArrayType as_rotvec (self, bool degrees=False)
 Represent as rotation vector. More...
 
ArrayType as_mrp (self)
 Represent as Modified Rodrigues Parameters (MRPs). More...
 
ArrayType as_euler (self, str seq, bool degrees=False)
 Represent as Euler angles. More...
 

Static Public Member Functions

def identity ()
 Get the identity rotation. More...
 
def random ()
 Generate uniformly distributed rotations. More...
 
def symbolic ()
 Symbolic representation. More...
 
def from_quat (ArrayType quat, str seq="xyzw")
 Initialize from quaternion. More...
 
def from_matrix (ArrayType matrix)
 Initialize from rotation matrix. More...
 
def from_rotvec (ArrayType rotvec, bool degrees=False)
 Initialize from rotation vectors. More...
 
def from_mrp (ArrayType mrp)
 Initialize from Modified Rodrigues Parameters (MRPs). More...
 
def from_euler (seq, angles, degrees=False)
 Initialize from Euler angles. More...
 

Private Attributes

 _quat
 

Detailed Description

A class for representing spatial rotations.

Constructor & Destructor Documentation

◆ __init__()

def spatial_casadi.spatial.Rotation.__init__ (   self,
ArrayType  quat,
bool   normalize = True 
)

Initializer for the Rotation class.

Parameters
quatQuaternion representing the rotation.
normalizeWhen true, the quaternion is normalized.
Returns
An instance of the Rotation class.

Member Function Documentation

◆ __mul__()

def spatial_casadi.spatial.Rotation.__mul__ (   self,
  other 
)

Compose this rotation with the other.

Parameters
otherObject containing the rotation or translation to be composed with this one. Note that compositions are not commutative, so p * q is different from q * p. In the case of translations q * p is undefined.
Returns
The product A * B, if other is a rotation the output will be a rotation. However, if other is a translation then the output will also be a translation.

◆ as_euler()

ArrayType spatial_casadi.spatial.Rotation.as_euler (   self,
str  seq,
bool   degrees = False 
)

Represent as Euler angles.

Parameters
seqSpecifies sequence of axes for rotations. Up to 3 characters belonging to the set {‘X’, ‘Y’, ‘Z’} for intrinsic rotations, or {‘x’, ‘y’, ‘z’} for extrinsic rotations. Extrinsic and intrinsic rotations cannot be mixed in one function call.
degreesReturned angles are in degrees if this flag is True, else they are in radians. Default is False.
Returns
Euler angles specified in radians (degrees is False) or degrees (degrees is True).

◆ as_matrix()

ArrayType spatial_casadi.spatial.Rotation.as_matrix (   self)

Represent as rotation matrix.

Returns
A 3-by-3 rotation matrix.

◆ as_mrp()

ArrayType spatial_casadi.spatial.Rotation.as_mrp (   self)

Represent as Modified Rodrigues Parameters (MRPs).

Returns
A vector giving the MRP, a 3 dimensional vector co-directional to the axis of rotation and whose magnitude is equal to tan(theta / 4), where theta is the angle of rotation (in radians).

◆ as_quat()

ArrayType spatial_casadi.spatial.Rotation.as_quat (   self,
str   seq = "xyzw" 
)

Represent as quaternions.

Parameters
seqSpecifies the ordering of the quaternion. Available options are 'wxyz' (i.e. scalar-first) and 'xyzw' (i.e. scalar-last). The default is the scalar-last format given by 'xyzw'.
Returns
A quaternion vector.

◆ as_rotvec()

ArrayType spatial_casadi.spatial.Rotation.as_rotvec (   self,
bool   degrees = False 
)

Represent as rotation vector.

Parameters
degreesIf True, then the given magnitudes are assumed to be in degrees. Default is False.
Returns
A 3-dimensional rotation vector

◆ from_euler()

def spatial_casadi.spatial.Rotation.from_euler (   seq,
  angles,
  degrees = False 
)
static

Initialize from Euler angles.

Parameters
seqSpecifies sequence of axes for rotations. Up to 3 characters belonging to the set {‘X’, ‘Y’, ‘Z’} for intrinsic rotations, or {‘x’, ‘y’, ‘z’} for extrinsic rotations. Extrinsic and intrinsic rotations cannot be mixed in one function call.
anglesEuler angles specified in radians (degrees is False) or degrees (degrees is True). For a single character seq, angles can be:
  • a single value.
  • array_like with shape (N,), where each angle[i] corresponds to a single rotation.
degreesIf True, then the given angles are assumed to be in degrees. Default is False.
Returns
Object containing the rotation represented by the rotation around given axes with given angles.

◆ from_matrix()

def spatial_casadi.spatial.Rotation.from_matrix ( ArrayType  matrix)
static

Initialize from rotation matrix.

Parameters
matrixA 3-by-3 rotation matrix or 4-by-4 homogeneous transformation matrix.
Returns
Object containing the rotation represented by the rotation matrix.

◆ from_mrp()

def spatial_casadi.spatial.Rotation.from_mrp ( ArrayType  mrp)
static

Initialize from Modified Rodrigues Parameters (MRPs).

Parameters
mrpA vector giving the MRP, a 3 dimensional vector co-directional to the axis of rotation and whose magnitude is equal to tan(theta / 4), where theta is the angle of rotation (in radians).

◆ from_quat()

def spatial_casadi.spatial.Rotation.from_quat ( ArrayType  quat,
str   seq = "xyzw" 
)
static

Initialize from quaternion.

Parameters
quatThe quaternion. The quaternion will be normalized to unit norm.
seqSpecifies the ordering of the quaternion. Available options are 'wxyz' (i.e. scalar-first) and 'xyzw' (i.e. scalar-last). The default is the scalar-last format given by 'xyzw'.
Returns
Object containing the rotation represented by the input quaternion.

◆ from_rotvec()

def spatial_casadi.spatial.Rotation.from_rotvec ( ArrayType  rotvec,
bool   degrees = False 
)
static

Initialize from rotation vectors.

Parameters
rotvecA 3-dimensional rotation vector
degreesIf True, then the given magnitudes are assumed to be in degrees. Default is False.

◆ identity()

def spatial_casadi.spatial.Rotation.identity ( )
static

Get the identity rotation.

◆ inv()

def spatial_casadi.spatial.Rotation.inv (   self)

Invert this rotation.

◆ random()

def spatial_casadi.spatial.Rotation.random ( )
static

Generate uniformly distributed rotations.

Returns
Random rotation.

◆ symbolic()

def spatial_casadi.spatial.Rotation.symbolic ( )
static

Symbolic representation.

Returns
Symbolic rotation.

Member Data Documentation

◆ _quat

spatial_casadi.spatial.Rotation._quat
private

The documentation for this class was generated from the following file: