(self)
return frame_vels
Calculates the frame velocity of each frame in the motion (self._frames).

    Return:
      An array containing velocities at each frame in self._frames.
Calculates the frame velocity of each frame in the motion (self._frames).
Calculates the frame velocity of each frame in the motion ( self . _frames ) .
def _calc_frame_vels(self):
    """Calculates the frame velocity of each frame in the motion (self._frames).

    Return:
      An array containing velocities at each frame in self._frames.
    """
    num_frames = self.get_num_frames()
    frame_vel_size = self.get_frame_vel_size()
    dt = self.get_frame_duration()
    frame_vels = np.zeros([num_frames, frame_vel_size])

    for f in range(num_frames - 1):
      frame0 = self.get_frame(f)
      frame1 = self.get_frame(f + 1)

      root_pos0 = self.get_frame_root_pos(frame0)
      root_pos1 = self.get_frame_root_pos(frame1)

      root_rot0 = self.get_frame_root_rot(frame0)
      root_rot1 = self.get_frame_root_rot(frame1)

      joints0 = self.get_frame_joints(frame0)
      joints1 = self.get_frame_joints(frame1)

      root_vel = (root_pos1 - root_pos0) / dt

      root_rot_diff = transformations.quaternion_multiply(
          root_rot1, transformations.quaternion_conjugate(root_rot0))
      root_rot_diff_axis, root_rot_diff_angle = \
        pose3d.QuaternionToAxisAngle(root_rot_diff)
      root_ang_vel = (root_rot_diff_angle / dt) * root_rot_diff_axis

      joints_vel = (joints1 - joints0) / dt

      curr_frame_vel = np.zeros(frame_vel_size)
      self.set_frame_root_vel(root_vel, curr_frame_vel)
      self.set_frame_root_ang_vel(root_ang_vel, curr_frame_vel)
      self.set_frame_joints_vel(joints_vel, curr_frame_vel)

      frame_vels[f, :] = curr_frame_vel

    # replicate the velocity at the last frame
    if num_frames > 1:
      frame_vels[-1, :] = frame_vels[-2, :]

    return frame_vels
def _calc_frame_vels ( self ) : num_frames = self . get_num_frames ( ) frame_vel_size = self . get_frame_vel_size ( ) dt = self . get_frame_duration ( ) frame_vels = np . zeros ( [ num_frames , frame_vel_size ] ) for f in range ( num_frames - 1 ) : frame0 = self . get_frame ( f ) frame1 = self . get_frame ( f + 1 ) root_pos0 = self . get_frame_root_pos ( frame0 ) root_pos1 = self . get_frame_root_pos ( frame1 ) root_rot0 = self . get_frame_root_rot ( frame0 ) root_rot1 = self . get_frame_root_rot ( frame1 ) joints0 = self . get_frame_joints ( frame0 ) joints1 = self . get_frame_joints ( frame1 ) root_vel = ( root_pos1 - root_pos0 ) / dt root_rot_diff = transformations . quaternion_multiply ( root_rot1 , transformations . quaternion_conjugate ( root_rot0 ) ) root_rot_diff_axis , root_rot_diff_angle = pose3d . QuaternionToAxisAngle ( root_rot_diff ) root_ang_vel = ( root_rot_diff_angle / dt ) * root_rot_diff_axis joints_vel = ( joints1 - joints0 ) / dt curr_frame_vel = np . zeros ( frame_vel_size ) self . set_frame_root_vel ( root_vel , curr_frame_vel ) self . set_frame_root_ang_vel ( root_ang_vel , curr_frame_vel ) self . set_frame_joints_vel ( joints_vel , curr_frame_vel ) frame_vels [ f , : ] = curr_frame_vel # replicate the velocity at the last frame if num_frames > 1 : frame_vels [ - 1 , : ] = frame_vels [ - 2 , : ] return frame_vels