- classmethod WXRotation.from_mrp(cls, mrp)#
Initialize from Modified Rodrigues Parameters (MRPs).
MRPs are a 3 dimensional vector co-directional to the axis of rotation and whose magnitude is equal to
tan(theta / 4), where
thetais the angle of rotation (in radians) .
MRPs have a singuarity at 360 degrees which can be avoided by ensuring the angle of rotation does not exceed 180 degrees, i.e. switching the direction of the rotation when it is past 180 degrees.
mrp (array_like, shape (N, 3) or (3,)) – A single vector or a stack of vectors, where
mrp[i]gives the ith set of MRPs.
rotation – Object containing the rotations represented by input MRPs.
- Return type:
Shuster, M. D. “A Survery of Attitude Representations”, The Journal of Astronautical Sciences, Vol. 41, No.4, 1993, pp. 475-476
New in version 1.6.0.
>>> from scipy.spatial.transform import Rotation as R >>> import numpy as np
Initialize a single rotation:
>>> r = R.from_mrp([0, 0, 1]) >>> r.as_euler('xyz', degrees=True) array([0. , 0. , 180. ]) >>> r.as_euler('xyz').shape (3,)
Initialize multiple rotations in one object:
>>> r = R.from_mrp([ ... [0, 0, 1], ... [1, 0, 0]]) >>> r.as_euler('xyz', degrees=True) array([[0. , 0. , 180. ], [180.0 , 0. , 0. ]]) >>> r.as_euler('xyz').shape (2, 3)
It is also possible to have a stack of a single rotation:
>>> r = R.from_mrp([[0, 0, np.pi/2]]) >>> r.as_euler('xyz').shape (1, 3)