def enforce_positive_q_rot_w(self):
    """ Enforce a positive real part of the rotation quaternion. """
    assert self.norm()[0] > 1e-8
    if self.q_rot.w < 0.0:
      self.dq = -self.dq
 Enforce a positive real part of the rotation quaternion. 
hand_eye_calibration/python/hand_eye_calibration/dual_quaternion.py