gaitmap.utils.rotations.get_gravity_rotation#
- gaitmap.utils.rotations.get_gravity_rotation(gravity_vector: ndarray, expected_gravity: ndarray = array([0., 0., 9.81])) Rotation[source]#
Find the rotation matrix needed to align z-axis with gravity.
- Parameters:
- gravity_vectorvector with shape (3,)
axis ([x, y ,z])
- expected_gravityvector with shape (3,)
axis ([x, y ,z])
- Returns:
- rotation
rotation between given gravity vector and the expected gravity
Examples
>>> goal = np.array([0, 0, 1]) >>> start = np.array([1, 0, 0]) >>> rot = get_gravity_rotation(start) >>> rotated = rot.apply(start) >>> rotated array([0., 0., 1.])