Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
pymavlink.quaternion.Quaternion Class Reference
Inheritance diagram for pymavlink.quaternion.Quaternion:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, attitude)
 
def __mul__ (self, other)
 
def __truediv__ (self, other)
 
def dcm (self)
 
def dcm (self, dcm)
 
def inversed (self)
 
def transform (self, v3)
 

Public Attributes

 dcm
 
 q
 

Private Member Functions

def _dcm_array_to_matrix3 (self, dcm)
 
def _dcm_to_euler (self, dcm)
 
def _dcm_to_q (self, dcm)
 
def _euler_to_dcm (self, euler)
 
def _matrix3_to_dcm_array (self, m)
 
def _q_to_dcm (self, q)
 

Private Attributes

 _dcm
 
 _euler
 
 _q
 

Additional Inherited Members

Detailed Description

Quaternion class that supports pymavlink's Vector3 and Matrix3

Usage:
    >>> from quaternion import Quaternion
    >>> from rotmat import Vector3, Matrix3
    >>> m = Matrix3()
    >>> m.from_euler(45, 0, 0)
    >>> print(m)
    Matrix3((1.00, 0.00, 0.00), (0.00, 0.53, -0.85), (-0.00, 0.85, 0.53))
    >>> q = Quaternion(m)
    >>> print(q)
    [ 0.87330464  0.48717451  0.          0.        ]
    >>> print(q.dcm)
    Matrix3((1.00, 0.00, 0.00), (0.00, 0.53, -0.85), (-0.00, 0.85, 0.53))
    >>> v = Vector3(0, 1, 0)
    >>> v2 = q.transform(v)
    >>> print(v2)
    Vector3(0.00, 0.53, 0.85)

Definition at line 454 of file quaternion.py.

Constructor & Destructor Documentation

def pymavlink.quaternion.Quaternion.__init__ (   self,
  attitude 
)
Construct a quaternion from an attitude

:param attitude: another Quaternion, QuaternionBase,
    3 element list [roll, pitch, yaw],
    4 element list [w, x, y ,z], DCM (3x3 array or Matrix3)

Definition at line 477 of file quaternion.py.

Member Function Documentation

def pymavlink.quaternion.Quaternion.__mul__ (   self,
  other 
)
:param other: Quaternion
:returns: multiplaction of this Quaternion with other

Definition at line 616 of file quaternion.py.

def pymavlink.quaternion.Quaternion.__truediv__ (   self,
  other 
)
:param other: Quaternion
:returns: division of this Quaternion with other

Definition at line 623 of file quaternion.py.

def pymavlink.quaternion.Quaternion._dcm_array_to_matrix3 (   self,
  dcm 
)
private
Converts dcm array into Matrix3
:param dcm: 3x3 dcm array
:returns: Matrix3

Definition at line 553 of file quaternion.py.

def pymavlink.quaternion.Quaternion._dcm_to_euler (   self,
  dcm 
)
private
Create DCM from euler angles
:param dcm: Matrix3
:returns: array [roll, pitch, yaw] in rad

Definition at line 607 of file quaternion.py.

def pymavlink.quaternion.Quaternion._dcm_to_q (   self,
  dcm 
)
private
Create q from dcm (Matrix3)
:param dcm: Matrix3
:returns: array q which represents a quaternion [w, x, y, z]

Definition at line 586 of file quaternion.py.

def pymavlink.quaternion.Quaternion._euler_to_dcm (   self,
  euler 
)
private
Create DCM (Matrix3) from euler angles
:param euler: array [roll, pitch, yaw] in rad
:returns: Matrix3

Definition at line 596 of file quaternion.py.

def pymavlink.quaternion.Quaternion._matrix3_to_dcm_array (   self,
  m 
)
private
Converts Matrix3 in an array
:param m: Matrix3
:returns: 3x3 array

Definition at line 565 of file quaternion.py.

def pymavlink.quaternion.Quaternion._q_to_dcm (   self,
  q 
)
private
Create DCM (Matrix3) from q
:param q: array q which represents a quaternion [w, x, y, z]
:returns: Matrix3

Definition at line 576 of file quaternion.py.

def pymavlink.quaternion.Quaternion.dcm (   self)
Get the DCM

:returns: Matrix3

Definition at line 500 of file quaternion.py.

def pymavlink.quaternion.Quaternion.dcm (   self,
  dcm 
)
Set the DCM
:param dcm: Matrix3

Definition at line 516 of file quaternion.py.

def pymavlink.quaternion.Quaternion.inversed (   self)
Get inversed quaternion

:returns: inversed quaternion

Definition at line 531 of file quaternion.py.

def pymavlink.quaternion.Quaternion.transform (   self,
  v3 
)
Calculates the vector transformed by this quaternion
:param v3: Vector3 to be transformed
:returns: transformed vector

Definition at line 539 of file quaternion.py.

Member Data Documentation

pymavlink.quaternion.Quaternion._dcm
private

Definition at line 509 of file quaternion.py.

pymavlink.quaternion.Quaternion._euler
private

Definition at line 528 of file quaternion.py.

pymavlink.quaternion.Quaternion._q
private

Definition at line 527 of file quaternion.py.

pymavlink.quaternion.Quaternion.dcm

Definition at line 488 of file quaternion.py.

pymavlink.quaternion.Quaternion.q

Definition at line 486 of file quaternion.py.


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


mavlink
Author(s): Lorenz Meier
autogenerated on Sun Apr 7 2019 02:06:02