(self, motion_file)
return
Load motion data from file.

    The file must be in JSON format.

    Args:
      motion_file: The path to the motion data file.
Load motion data from file.
Load motion data from file .
def load(self, motion_file):
    """Load motion data from file.

    The file must be in JSON format.

    Args:
      motion_file: The path to the motion data file.
    """

    logging.info("Loading motion from: {:s}".format(motion_file))
    with open(motion_file, "r") as f:
      motion_json = json.load(f)

      self._loop_mode = LoopMode[motion_json[self._LOOP_MODE_KEY]]
      self._frame_duration = float(motion_json[self._FRAME_DURATION_KEY])

      if self._ENABLE_CYCLE_OFFSET_POSITION_KEY in motion_json:
        self._enable_cycle_offset_pos = bool(
            motion_json[self._ENABLE_CYCLE_OFFSET_POSITION_KEY])
      else:
        self._enable_cycle_offset_pos = False

      if self._ENABLE_CYCLE_OFFSET_ROTATION_KEY in motion_json:
        self._enable_cycle_offset_rot = bool(
            motion_json[self._ENABLE_CYCLE_OFFSET_ROTATION_KEY])
      else:
        self._enable_cycle_offset_rot = False

      self._frames = np.array(motion_json[self._FRAMES_KEY])
      self._postprocess_frames(self._frames)

      self._frame_vels = self._calc_frame_vels()

      assert (self._frames.shape[0] > 0), "Must have at least 1 frame."
      assert (self._frames.shape[1] > self.POS_SIZE +
              self.ROT_SIZE), "Frames have too few degrees of freedom."
      assert (self._frame_duration > 0), "Frame duration must be positive."

      logging.info("Loaded motion from {:s}.".format(motion_file))

    return
def load ( self , motion_file ) : logging . info ( "Loading motion from: {:s}" . format ( motion_file ) ) with open ( motion_file , "r" ) as f : motion_json = json . load ( f ) self . _loop_mode = LoopMode [ motion_json [ self . _LOOP_MODE_KEY ] ] self . _frame_duration = float ( motion_json [ self . _FRAME_DURATION_KEY ] ) if self . _ENABLE_CYCLE_OFFSET_POSITION_KEY in motion_json : self . _enable_cycle_offset_pos = bool ( motion_json [ self . _ENABLE_CYCLE_OFFSET_POSITION_KEY ] ) else : self . _enable_cycle_offset_pos = False if self . _ENABLE_CYCLE_OFFSET_ROTATION_KEY in motion_json : self . _enable_cycle_offset_rot = bool ( motion_json [ self . _ENABLE_CYCLE_OFFSET_ROTATION_KEY ] ) else : self . _enable_cycle_offset_rot = False self . _frames = np . array ( motion_json [ self . _FRAMES_KEY ] ) self . _postprocess_frames ( self . _frames ) self . _frame_vels = self . _calc_frame_vels ( ) assert ( self . _frames . shape [ 0 ] > 0 ) , "Must have at least 1 frame." assert ( self . _frames . shape [ 1 ] > self . POS_SIZE + self . ROT_SIZE ) , "Frames have too few degrees of freedom." assert ( self . _frame_duration > 0 ) , "Frame duration must be positive." logging . info ( "Loaded motion from {:s}." . format ( motion_file ) ) return