ctrlutils.near_quaternion¶
- ctrlutils.near_quaternion(*args, **kwargs)¶
Overloaded function.
near_quaternion(quat: Eigen::Quaternion<double, 0>, quat_reference: Eigen::Quaternion<double, 0>) -> Eigen::Quaternion<double, 0>
Computes the quaternion for the given orientation that is closer to the reference quaternion.
Each 3D orientation can be represented by two quaternions, where one quaternion has the same 4 elements as the other but negated. Of these two quaternions, the one that is “closer” to the reference is the one that has a positive dot product with the reference.
This function may be used in orientation control, where quat is the goal orientation, and quat_reference is the current orientation of the controlled body. The effect of controlling the body to the closer quaternion is that it will rotate the shortest way to the goal orientation. Using the farther quarternion will cause it to rotate the long way around, which may be desired to avoid singularities, for example.
- Args:
quat: Quaternion representing the desired orientation. quat_ref: Reference quaternion.
- Returns:
The quaternion that represents the same orientation as quat but has a positive dot product with quat_ref.
See also
near_quaternion(ori: numpy.ndarray[numpy.float64[3, 3], flags.f_contiguous], quat_reference: Eigen::Quaternion<double, 0>) -> Eigen::Quaternion<double, 0>
Computes the quaternion for the given orientation that is closer to the reference quaternion.
- Args:
ori: 3D matrix representing the desired orientation. quat_ref: Reference quaternion.
- Returns:
The quaternion that represents the same orientation as ori but has a positive dot product with quat_ref.
See also