Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
pymavlink.quaternion.QuaternionBase Class Reference
Inheritance diagram for pymavlink.quaternion.QuaternionBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __eq__
def __getitem__
def __init__
def __mul__
def __str__
def __truediv__
def close
def dcm
def dcm
def euler
def euler
def inversed
def norm
def normalize
def q
def q
def transform

Static Public Member Functions

def norm_array
def normalize_array

Public Attributes

 dcm
 euler
 q

Private Member Functions

def _dcm_to_euler
def _dcm_to_q
def _euler_to_dcm
def _euler_to_q
def _mul_array
def _q_inversed
def _q_to_dcm

Private Attributes

 _dcm
 _euler
 _q

Detailed Description

Quaternion class, this is the version which supports numpy arrays
If you need support for Matrix3 look at the Quaternion class

Usage:
    >>> from quaternion import QuaternionBase
    >>> import numpy as np
    >>> q = QuaternionBase([np.radians(20), np.radians(20), np.radians(20)])
    >>> print(q)
    [ 0.9603483   0.13871646  0.19810763  0.13871646]
    >>> print(q.dcm)
    [[ 0.88302222 -0.21147065  0.41898917]
     [ 0.3213938   0.92303098 -0.21147065]
     [-0.34202014  0.3213938   0.88302222]]
    >>> q = QuaternionBase([1, 0, 0, 0])
    >>> print(q.euler)
    [ 0. -0.  0.]
    >>> m = [[1, 0, 0], [0, 0, -1], [0, 1, 0]]
    >>> q = QuaternionBase(m)
    >>> vector = [0, 1, 0]
    >>> vector2 = q.transform(vector)

Definition at line 18 of file quaternion.py.


Constructor & Destructor Documentation

def pymavlink.quaternion.QuaternionBase.__init__ (   self,
  attitude = [1 
)
Construct a quaternion from an attitude

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

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 43 of file quaternion.py.


Member Function Documentation

def pymavlink.quaternion.QuaternionBase.__eq__ (   self,
  other 
)
Equality test (same orientation, not necessarily same rotation)

:param other: a QuaternionBase
:returns: true if the quaternions are equal

Definition at line 201 of file quaternion.py.

Returns the quaternion entry at index

Definition at line 77 of file quaternion.py.

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

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 225 of file quaternion.py.

String of quaternion values

Definition at line 447 of file quaternion.py.

:param other: QuaternionBase
:returns: division of this Quaternion with other

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 239 of file quaternion.py.

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

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 415 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase._dcm_to_q (   self,
  dcm 
) [private]
Create q from dcm
Reference:
    - Shoemake, Quaternions,
    http://www.cs.ucr.edu/~vbz/resources/quatut.pdf

:param dcm: 3x3 dcm array
returns: quaternion array

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 348 of file quaternion.py.

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

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 384 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase._euler_to_q (   self,
  euler 
) [private]
Create q array from euler angles
:param euler: array [roll, pitch, yaw] in rad
:returns: array q which represents a quaternion [w, x, y, z]

Definition at line 293 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase._mul_array (   self,
  p,
  q 
) [private]
Performs multiplication of the 2 quaterniona arrays p and q
:param p: array of len 4
:param q: array of len 4
:returns: array of len, result of p * q (with p, q quaternions)

Definition at line 274 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase._q_inversed (   self,
  q 
) [private]
Returns inversed quaternion q
:param q: array q which represents a quaternion [w, x, y, z]
:returns: inversed array q which is a quaternion [w, x, y ,z]

Definition at line 438 of file quaternion.py.

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

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 320 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase.close (   self,
  other 
)
Equality test with tolerance
(same orientation, not necessarily same rotation)


:param other: a QuaternionBase
:returns: true if the quaternions are almost equal

Definition at line 212 of file quaternion.py.

Get the DCM

:returns: 3x3 array

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 128 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase.dcm (   self,
  dcm 
)
Set the DCM
:param dcm: 3x3 array

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 144 of file quaternion.py.

Get the euler angles.
The convention is Tait-Bryan (ZY'X'')

:returns: array containing the euler angles [roll, pitch, yaw]

Definition at line 95 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase.euler (   self,
  euler 
)
Set the euler angles
:param euler: list or array of the euler angles [roll, pitch, yaw]

Definition at line 113 of file quaternion.py.

Get inversed quaternion

:returns: inversed quaternion

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 192 of file quaternion.py.

Returns norm of quaternion

:returns: norm (scalar)

Definition at line 179 of file quaternion.py.

Calculate quaternion norm on array q
:param quaternion: array of len 4
:returns: norm (scalar)

Definition at line 265 of file quaternion.py.

Normalizes the quaternion

Definition at line 187 of file quaternion.py.

Normalizes the list with len 4 so that it can be used as quaternion
:param q: array of len 4
:returns: normalized array

Definition at line 253 of file quaternion.py.

Get the quaternion
:returns: array containing the quaternion elements

Definition at line 63 of file quaternion.py.

def pymavlink.quaternion.QuaternionBase.q (   self,
  q 
)
Set the quaternion
:param q: list or array of quaternion values [w, x, y, z]

Definition at line 82 of file quaternion.py.

Calculates the vector transformed by this quaternion
:param v: array with len 3 to be transformed
:returns: transformed vector

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 161 of file quaternion.py.


Member Data Documentation

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 85 of file quaternion.py.

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 85 of file quaternion.py.

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 66 of file quaternion.py.

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 49 of file quaternion.py.

Definition at line 49 of file quaternion.py.

Reimplemented in pymavlink.quaternion.Quaternion.

Definition at line 49 of file quaternion.py.


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


mavlink
Author(s): Lorenz Meier
autogenerated on Wed Sep 9 2015 18:06:18