skrobot.coordinates.math.midrot

skrobot.coordinates.math.midrot(p, r1, r2)[source]

Returns mid (or p) rotation matrix of given two matrix r1 and r2.

Parameters:
Returns:

r – 3x3 rotation matrix

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> from skrobot.coordinates.math import midrot
>>> midrot(0.5,
        np.eye(3),
        np.array([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]))
array([[ 0.70710678,  0.        ,  0.70710678],
       [ 0.        ,  1.        ,  0.        ],
       [-0.70710678,  0.        ,  0.70710678]])
>>> from skrobot.coordinates.math import rpy_angle
>>> np.rad2deg(rpy_angle(midrot(0.5,
               np.eye(3),
               np.array([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])))[0])
array([ 0., 45.,  0.])