Implementation:Facebookresearch Habitat lab HumanoidSeqPoseController
| Knowledge Sources | |
|---|---|
| Domains | Embodied_AI, Humanoid_Animation |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
HumanoidSeqPoseController is a controller that replays a sequence of pre-recorded humanoid poses loaded from a file, extending HumanoidBaseController with sequential motion playback capabilities.
Description
HumanoidSeqPoseController extends HumanoidBaseController to support loading and sequentially replaying humanoid motion data from a NumPy archive file. On initialization, it loads a motion file containing joint arrays, transform arrays, displacement data, and FPS information, constructing a Motion object from this data.
Key features include:
- Sequential playback -- Supports forward (
next_pose) and backward (prev_pose) traversal through the motion sequence, with optional cycling at the boundaries. - Reference-based positioning -- The first pose in the motion file is set at the provided base transformation, and all subsequent poses are computed relative to that reference.
- Base transformation application -- The
apply_base_transformationmethod allows repositioning the motion sequence by setting a new base offset that makes subsequent poses relative to the given transformation. - Step size control -- The step size is calculated as the ratio of the motion file's native FPS to the desired playback FPS, allowing temporal resampling of the motion.
The calculate_pose method computes the current joint transforms based on the current motion frame, adjusting the root transform relative to the first pose and the reference pose.
Usage
Use HumanoidSeqPoseController when you need to replay pre-recorded humanoid motion sequences in Habitat simulations. Instantiate it with a path to a .npz motion file, reset it with a base transformation, and then call calculate_pose(advance_pose=True) each step to progress through the animation.
Code Reference
Source Location
- Repository: Facebookresearch_Habitat_lab
- File: habitat-lab/habitat/articulated_agent_controllers/humanoid_seq_pose_controller.py
- Lines: 1-127
Signature
class HumanoidSeqPoseController(HumanoidBaseController):
def __init__(
self,
motion_pose_path,
motion_fps=30,
base_offset=(0, 0.9, 0),
):
Import
from habitat.articulated_agent_controllers.humanoid_seq_pose_controller import (
HumanoidSeqPoseController,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| motion_pose_path | str | Yes | File path to the .npz file containing motion pose data
|
| motion_fps | int | No (default=30) | The FPS at which the pose should be advanced during playback |
| base_offset | tuple | No (default=(0, 0.9, 0)) | Offset between the root of the character and their feet |
Outputs
| Name | Type | Description |
|---|---|---|
| get_pose() | List[float] | Inherited vectorized pose from HumanoidBaseController containing joint poses and transforms |
| humanoid_motion | Motion | The loaded motion sequence object |
| motion_frame | int | Current frame index in the motion sequence |
Key Methods
| Method | Description |
|---|---|
reset(base_transformation) |
Resets the controller to frame 0 and sets the reference pose to the given base transformation |
apply_base_transformation(base_transformation) |
Sets a base offset so subsequent poses are relative to the given transformation |
next_pose(cycle=False) |
Advances to the next pose; optionally cycles back to the beginning at the end |
prev_pose(cycle=False) |
Moves to the previous pose; optionally cycles to the end when reaching the start |
calculate_pose(advance_pose=False) |
Computes joint transforms for the current frame; optionally advances to the next pose |
Usage Examples
Basic Usage
import magnum as mn
from habitat.articulated_agent_controllers.humanoid_seq_pose_controller import (
HumanoidSeqPoseController,
)
# Load a motion file and create the controller
controller = HumanoidSeqPoseController(
motion_pose_path="data/humanoid_motions/walk_motion.npz",
motion_fps=30,
)
# Reset at a starting transformation
base_transform = mn.Matrix4.identity_init()
controller.reset(base_transform)
# Step through the motion sequence
for step in range(100):
controller.calculate_pose(advance_pose=True)
pose = controller.get_pose()
# Use pose to update humanoid agent in simulation