Package geometry :: Module rotations
[hide private]
[frames] | no frames]

Module rotations

source code

Contains all about rotation matrices, quaternions, and various conversions.

conventions: q=( a + bi + cj + dk), with a>0

Functions [hide private]
 
SO2_from_angle(theta)
Returns a 2x2 rotation matrix.
source code
 
angle_from_SO2(R)
:param R: :type R: ``SO2``
source code
 
angle_from_rot2d(R)
:param R: :type R: ``SO2``
source code
 
axis_angle_from_quaternion(q)
This is the inverse of :py:func:`quaternion_from_axis_angle`.
source code
 
axis_angle_from_rotation(R)
Returns the *(axis,angle)* representation of a given rotation.
source code
 
check_SO(x)
Checks that the given value is a rotation matrix of arbitrary size.
source code
 
check_orthogonal(x)
Check that the argument is an orthogonal matrix.
source code
 
check_skew_symmetric(x)
Check that the argument is a skew-symmetric matrix.
source code
 
geodesic_distance_for_rotations(R1, R2)
Returns the geodesic distance between two rotation matrices.
source code
 
hat_map(v)
Maps a vector to a 3x3 skew symmetric matrix.
source code
 
hat_map_2d(omega)
:param omega: :type omega: ``number``
source code
 
map_hat(H)
The inverse of :py:func:`hat_map`.
source code
 
map_hat_2d(W)
:param W: :type W: ``so2``
source code
 
quaternion_from_axis_angle(axis, angle)
Computes a quaternion corresponding to the rotation of *angle* radians around the given *axis*.
source code
 
quaternion_from_rotation(R)
Converts a rotation matrix to a quaternion.
source code
 
random_orthogonal_transform()
:rtype: ``array[3x3],orthogonal``
source code
 
random_quaternion()
Generate a random quaternion.
source code
 
random_rotation(ndim=3)
Generate a random rotation matrix.
source code
 
rot2d(theta)
Returns a 2x2 rotation matrix.
source code
 
rot2d_from_angle(theta)
Returns a 2x2 rotation matrix.
source code
 
rotation_from_axes_spec(x_axis, vector_on_xy_plane)
Creates a rotation matrix from the axes.
source code
 
rotation_from_axis_angle(axis, angle)
Computes the rotation matrix from the *(axis,angle)* representation using Rodriguez's formula.
source code
 
rotation_from_axis_angle2(axis, angle)
Get the rotation from the *(axis,angle)* representation.
source code
 
rotation_from_quaternion(x)
Converts a quaternion to a rotation matrix.
source code
 
rotz(theta)
Returns a 3x3 rotation matrix corresponding to rotation around the *z* axis.
source code
Variables [hide private]
  __package__ = 'geometry'
Function Details [hide private]

SO2_from_angle(theta)

source code 

Returns a 2x2 rotation matrix.

:param theta: :type theta: ``number``

:rtype: ``SO2``

angle_from_SO2(R)

source code 

:param R: :type R: ``SO2``

:rtype: ``float``

angle_from_rot2d(R)

source code 

:param R: :type R: ``SO2``

:rtype: ``float``

axis_angle_from_quaternion(q)

source code 

       This is the inverse of :py:func:`quaternion_from_axis_angle`.
   


:param q: 
:type q:  ``unit_quaternion``

:rtype:  ``axis_angle_canonical``

axis_angle_from_rotation(R)

source code 

       Returns the *(axis,angle)* representation of a given rotation.
       
       There are a couple of symmetries:
   
       * By convention, the angle returned is nonnegative.
        
       * If the angle is 0, any axis will do. 
         In that case, :py:func:`default_axis` will be returned. 
         
   


:param R: 
:type R:  ``rotation_matrix``

:rtype:  ``axis_angle_canonical``

check_SO(x)

source code 

Checks that the given value is a rotation matrix of arbitrary size.

:param x: :type x: ``array[NxN],N>0``

check_orthogonal(x)

source code 

Check that the argument is an orthogonal matrix.

:param x: :type x: ``array[NxN],N>0``

check_skew_symmetric(x)

source code 

Check that the argument is a skew-symmetric matrix.

:param x: :type x: ``array[NxN]``

geodesic_distance_for_rotations(R1, R2)

source code 

       Returns the geodesic distance between two rotation matrices.
       
       It is computed as the angle of the rotation :math:`R_1^{*} R_2^{-1}``.
   
   


:param R1: 
:type R1:  ``rotation_matrix``

:param R2: 
:type R2:  ``rotation_matrix``

:rtype:  ``float,>=0,<=pi``

hat_map(v)

source code 

Maps a vector to a 3x3 skew symmetric matrix.

:param v: :type v: ``array[3]``

:rtype: ``array[3x3],skew_symmetric``

hat_map_2d(omega)

source code 

:param omega: :type omega: ``number``

:rtype: ``so2``

map_hat(H)

source code 

The inverse of :py:func:`hat_map`.

:param H: :type H: ``array[3x3],skew_symmetric``

:rtype: ``array[3]``

map_hat_2d(W)

source code 

:param W: :type W: ``so2``

:rtype: ``float``

quaternion_from_axis_angle(axis, angle)

source code 

       Computes a quaternion corresponding to the rotation of *angle* radians
       around the given *axis*.
       
       This is the inverse of :py:func:`axis_angle_from_quaternion`.
   


:param angle: 
:type angle:  ``float``

:param axis: 
:type axis:  ``direction``

:rtype:  ``unit_quaternion``

quaternion_from_rotation(R)

source code 

       Converts a rotation matrix to a quaternion.
   
       This is the robust method mentioned on wikipedia:
   
       <http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>
       
       TODO: add the more robust method with 4x4 matrix and eigenvector
   


:param R: 
:type R:  ``rotation_matrix``

:rtype:  ``unit_quaternion``

random_quaternion()

source code 
Generate a random quaternion.
       
       Uses the algorithm used in Kuffner, ICRA'04.
   


:rtype:  ``unit_quaternion``

random_rotation(ndim=3)

source code 
Generate a random rotation matrix. 
       
       This is a wrapper around :py:func:`random_quaternion`.
   


:param ndim: 
:type ndim:  ``2|3``

:rtype:  ``array[2x2]|rotation_matrix``

rot2d(theta)

source code 

Returns a 2x2 rotation matrix.

:param theta: :type theta: ``number``

:rtype: ``SO2``

rot2d_from_angle(theta)

source code 

Returns a 2x2 rotation matrix.

:param theta: :type theta: ``number``

:rtype: ``SO2``

rotation_from_axes_spec(x_axis, vector_on_xy_plane)

source code 

       Creates a rotation matrix from the axes. 
       ``x_axis`` is the new direction of the (1,0,0) vector
       after this rotation. ``vector_on_xy_plane`` is a vector
       that must end up in the (x,y) plane after the rotation. 
       
       That is, it holds that: ::
       
           R = rotation_from_axes_spec(x, v)
           dot(R,x) == [1,0,0]
           dot(R,v) == [?,?,0]
    
       TODO: add exception if vectors are too close.
   


:param vector_on_xy_plane: 
:type vector_on_xy_plane:  ``direction``

:param x_axis: 
:type x_axis:  ``direction``

:rtype:  ``rotation_matrix``

rotation_from_axis_angle(axis, angle)

source code 

       Computes the rotation matrix from the *(axis,angle)* representation
       using Rodriguez's formula. 
   


:param angle: 
:type angle:  ``float``

:param axis: 
:type axis:  ``direction``

:rtype:  ``rotation_matrix``

rotation_from_axis_angle2(axis, angle)

source code 

       Get the rotation from the *(axis,angle)* representation.
       
       This is an alternative to :py:func:`rotation_from_axis_angle` which
       goes through the quaternion representation instead of using Rodrigues'
       formula.
   


:param angle: 
:type angle:  ``float``

:param axis: 
:type axis:  ``direction``

:rtype:  ``rotation_matrix``

rotation_from_quaternion(x)

source code 

       Converts a quaternion to a rotation matrix.
       
   


:param x: 
:type x:  ``unit_quaternion``

:rtype:  ``rotation_matrix``

rotz(theta)

source code 
Returns a 3x3 rotation matrix corresponding 
       to rotation around the *z* axis. 


:param theta: 
:type theta:  ``number``

:rtype:  ``SO3``