def angular_velocity_between_quaternions(q1, q2, t):
  """ Returns the angular velocity resulting from transitioning from q1 to q2
  in t. """
  q1_q2_inv = q1 * q2.inverse()
  # Ensure positive w.
  if q1_q2_inv.w < 0.:
    q1_q2_inv = -q1_q2_inv
  angle_axis = q1_q2_inv.angle_axis()
  return 0.5 / t * angle_axis[3] * angle_axis[0:3]
 Returns the angular velocity resulting from transitioning from q1 to q2
  in t. 
hand_eye_calibration/python/hand_eye_calibration/quaternion.py