rlightning.humanoid.utils.lafan_vendor.extract

class rlightning.humanoid.utils.lafan_vendor.extract.Anim(quats: MockModule('torch.Tensor'), pos: MockModule('torch.Tensor'), offsets: MockModule('torch.Tensor'), parents: Any, bones: List[str], frametime: float, fps: float = None)[source]

Bases: object

Basic animation structure

bones: List[str]

A list of joints

fps: float = None

Frequency

frametime: float

Frame time slot

offsets: MockModule('torch.Tensor')

Local joint offsets

parents: Any

Bone hierarchy

pos: MockModule('torch.Tensor')

Local positions

quats: MockModule('torch.Tensor')

Local quaternions

rlightning.humanoid.utils.lafan_vendor.extract.get_lafan1_set(bvh_path: str, actors, window=50, offset=20)[source]

Extract the same test set as in the article, given the location of the BVH files.

Parameters:
  • bvh_path – Path to the dataset BVH files

  • list – actor prefixes to use in set

  • window – width of the sliding windows (in timesteps)

  • offset – offset between windows (in timesteps)

Returns:

tuple: X: local positions Q: local quaternions parents: list of parent indices defining the bone hierarchy contacts_l: binary tensor of left-foot contacts of shape (Batchsize, Timesteps, 2) contacts_r: binary tensor of right-foot contacts of shape (Batchsize, Timesteps, 2)

rlightning.humanoid.utils.lafan_vendor.extract.get_train_stats(bvh_folder, train_set)[source]

Extract the same training set as in the paper in order to compute the normalizing statistics :return: Tuple of (local position mean vector, local position standard deviation vector, local joint offsets tensor)

rlightning.humanoid.utils.lafan_vendor.extract.read_bvh(filename: str, start: int = None, end: int = None, order=None) Anim[source]

Reading a BVH file and extracts animation information.

Parameters:
  • filename (str) – File path.

  • start (int, optional) – Strat frame idx. Defaults to None.

  • end (int, optional) – Ending frame idx. Defaults to None.

  • order (_type_, optional) – Order of euler rotations. Defaults to None.

Returns:

Parsed Animation object

Return type:

Anim

rlightning.humanoid.utils.lafan_vendor.extract.read_bvh_multi_channel(filename: str, start: int = None, end: int = None, order: Any = None) Anim[source]

Reading a BVH data that has multi channels.

Parameters:
  • filename (str) – File path.

  • start (int, optional) – Strating frame index. Defaults to None.

  • end (int, optional) – Ending frame index. Defaults to None.

  • order (Any, optional) – Ordering. Defaults to None.

Returns:

Animation instance

Return type:

Anim