(self, sync_root_position, sync_root_rotation)
return
Moves the origin of the reference motion, such that the root of the

    simulated and reference characters are at the same location. This is used
    to periodically synchronize the reference motion with the simulated
    character in order to mitigate drift.

    Args:
      sync_root_position: boolean indicating if the root position should be
        synchronized
      sync_root_rotation: boolean indicating if the root rotation should be
        synchronized
Moves the origin of the reference motion, such that the root of the
Moves the origin of the reference motion such that the root of the
def _sync_ref_origin(self, sync_root_position, sync_root_rotation):
    """Moves the origin of the reference motion, such that the root of the

    simulated and reference characters are at the same location. This is used
    to periodically synchronize the reference motion with the simulated
    character in order to mitigate drift.

    Args:
      sync_root_position: boolean indicating if the root position should be
        synchronized
      sync_root_rotation: boolean indicating if the root rotation should be
        synchronized
    """
    time = self._get_motion_time()
    motion = self.get_active_motion()
    ref_pose = self._calc_ref_pose(time, apply_origin_offset=False)

    if sync_root_rotation:
      ref_rot = motion.get_frame_root_rot(ref_pose)
      sim_rot = self._get_sim_base_rotation()
      ref_heading = self._calc_heading(ref_rot)
      sim_heading = self._calc_heading(sim_rot)
      heading_diff = sim_heading - ref_heading

      self._origin_offset_rot = transformations.quaternion_about_axis(
          heading_diff, [0, 0, 1])

    if sync_root_position:
      ref_pos = motion.get_frame_root_pos(ref_pose)
      ref_pos = pose3d.QuaternionRotatePoint(ref_pos, self._origin_offset_rot)
      sim_pos = self._get_sim_base_position()
      self._origin_offset_pos = sim_pos - ref_pos
      self._origin_offset_pos[2] = 0  # only sync along horizontal plane

    return
def _sync_ref_origin ( self , sync_root_position , sync_root_rotation ) : time = self . _get_motion_time ( ) motion = self . get_active_motion ( ) ref_pose = self . _calc_ref_pose ( time , apply_origin_offset = False ) if sync_root_rotation : ref_rot = motion . get_frame_root_rot ( ref_pose ) sim_rot = self . _get_sim_base_rotation ( ) ref_heading = self . _calc_heading ( ref_rot ) sim_heading = self . _calc_heading ( sim_rot ) heading_diff = sim_heading - ref_heading self . _origin_offset_rot = transformations . quaternion_about_axis ( heading_diff , [ 0 , 0 , 1 ] ) if sync_root_position : ref_pos = motion . get_frame_root_pos ( ref_pose ) ref_pos = pose3d . QuaternionRotatePoint ( ref_pos , self . _origin_offset_rot ) sim_pos = self . _get_sim_base_position ( ) self . _origin_offset_pos = sim_pos - ref_pos self . _origin_offset_pos [ 2 ] = 0 # only sync along horizontal plane return