skrobot.coordinates.math.rotation_angle
- skrobot.coordinates.math.rotation_angle(mat, return_angular_velocity=False)[source]
Inverse Rodrigues formula Convert Rotation-Matrix to Axis-Angle.
Return theta and axis. If given unit matrix, return None.
- Parameters:
mat (numpy.ndarray) – rotation matrix, shape (3, 3)
return_angular_velocity (bool, optional) – If True, returns the angular velocity vector instead of the axis-angle representation.
- Returns:
theta, axis or angular_velocity (tuple(float, numpy.ndarray))
or numpy.ndarray – Rotation angle in radian and rotation axis, or angular velocity vector if return_angular_velocity is True.
Examples
>>> import numpy >>> from skrobot.coordinates.math import rotation_angle >>> rotation_angle(numpy.eye(3)) is None True >>> rotation_angle(numpy.array([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])) (1.5707963267948966, array([0., 1., 0.]))