habitat.articulated_agent_controllers.HumanoidRearrangeController class

Humanoid Controller, converts high level actions such as walk, or reach into joints positions

Methods

def _trilinear_interpolate_pose(self, position: _magnum.Vector3, hand_data: typing.Tuple[typing.List[numpy.ndarray], typing.List[numpy.ndarray], typing.List[numpy.ndarray]]) -> typing.Tuple[typing.List[numpy.ndarray], _magnum.Matrix4]
Given a 3D coordinate position, computes the humanoid’s joints states + root rotations and translations to reach that position using trilinear interpolation.
def build_ik_vectors(self, hand_motion: Motion) -> typing.Tuple[typing.List[numpy.ndarray], typing.List[numpy.ndarray], typing.List[numpy.ndarray]]
Given a hand_motion Motion file containing different humanoid poses to reach objects with the hand, builds matrices of joint angles, root offset translations, and rotations so that they can be easily interpolated when reaching poses.
def calculate_reach_pose(self, obj_pos: _magnum.Vector3, index_hand: int = 0) -> None
Updates the controller’s humanoid state to reach position, obj_pos, with the hand.
def calculate_stop_pose(self) -> None
Calculates a stationary standing pose and sets it in the controller. Does not update the ManagedArticulatedObject state.
def calculate_turn_pose(self, target_position: _magnum.Vector3) -> None
Calculates next frame of motion (joint positions + root rotation) to rotate the character towards the target position without translation and sets it in the controller. Does not update the ManagedArticulatedObject state.
def calculate_walk_pose(self, target_position: _magnum.Vector3, distance_multiplier: float = 1.0) -> None
Calculates next frame of a walking motion (joint positions + root rotation and translation), so that the humanoid moves toward the relative target_position. Does not update the ManagedArticulatedObject state.
def calculate_walk_pose_directional(self, target_position: _magnum.Vector3, distance_multiplier = 1.0, target_dir: typing.Optional[_magnum.Vector3] = None) -> None
Calculates next frame of a walking motion (joint positions + root rotation and translation), so that the humanoid moves toward the relative target_position while facing the direction ‘target_dir’. Does not update the ManagedArticulatedObject state.
def get_pose(self) -> typing.List[float]
Obtains the controller joints, offset and base transform in a vectorized form so that it can be passed as an argument to HumanoidJointAction.
def reset(self, base_transformation: _magnum.Matrix4) -> None
Reset the joints on the human. (Put in rest state)
def set_framerate_for_linspeed(self, lin_speed: float, ang_speed: float, ctrl_freq: int) -> None
Set the linear and angular speed of the humanoid’s root motion based on the relative framerate of the simulator and the motion trajectory.
def translate_and_rotate_with_gait(self, forward_delta: float, rot_delta: float)
Translates the character in the forward direction and rotates the character

Special methods

def __init__(self, walk_pose_path: str, motion_fps: int = 30, base_offset: _magnum.Vector3 = Vector(0, 0.9, 0))

Method documentation

def habitat.articulated_agent_controllers.HumanoidRearrangeController._trilinear_interpolate_pose(self, position: _magnum.Vector3, hand_data: typing.Tuple[typing.List[numpy.ndarray], typing.List[numpy.ndarray], typing.List[numpy.ndarray]]) -> typing.Tuple[typing.List[numpy.ndarray], _magnum.Matrix4]

Given a 3D coordinate position, computes the humanoid’s joints states + root rotations and translations to reach that position using trilinear interpolation.

Parameters
position The position to reach for.
hand_data The joint quats, root rotations, and root translation for each frame of the input reaching Motion.

def habitat.articulated_agent_controllers.HumanoidRearrangeController.build_ik_vectors(self, hand_motion: Motion) -> typing.Tuple[typing.List[numpy.ndarray], typing.List[numpy.ndarray], typing.List[numpy.ndarray]]

Given a hand_motion Motion file containing different humanoid poses to reach objects with the hand, builds matrices of joint angles, root offset translations, and rotations so that they can be easily interpolated when reaching poses.

Parameters
hand_motion The hand Motion object.

def habitat.articulated_agent_controllers.HumanoidRearrangeController.calculate_reach_pose(self, obj_pos: _magnum.Vector3, index_hand: int = 0) -> None

Updates the controller’s humanoid state to reach position, obj_pos, with the hand.

Parameters
obj_pos The position to reach with the hand
index_hand is 0 or 1 corresponding to the left or right hand

def habitat.articulated_agent_controllers.HumanoidRearrangeController.calculate_walk_pose(self, target_position: _magnum.Vector3, distance_multiplier: float = 1.0) -> None

Calculates next frame of a walking motion (joint positions + root rotation and translation), so that the humanoid moves toward the relative target_position. Does not update the ManagedArticulatedObject state.

Parameters
target_position target position to move the character towards. Relative to the character’s root translation.
distance_multiplier multiplier on translation speed. ‘== 0’ creates a walk motion while not translating, for example to turn in place.

def habitat.articulated_agent_controllers.HumanoidRearrangeController.calculate_walk_pose_directional(self, target_position: _magnum.Vector3, distance_multiplier = 1.0, target_dir: typing.Optional[_magnum.Vector3] = None) -> None

Calculates next frame of a walking motion (joint positions + root rotation and translation), so that the humanoid moves toward the relative target_position while facing the direction ‘target_dir’. Does not update the ManagedArticulatedObject state.

Parameters
target_position target position to move the character towards. Relative to the character’s root translation.
distance_multiplier multiplier on translation speed. ‘== 0’ creates a walk motion while not translating, for example to turn in place.
target_dir the relative position we should be looking at. If None, rotates the agent to face target_position. Otherwise, it moves the agent towards target_position but facing target_dir. This is important for moving backwards.

def habitat.articulated_agent_controllers.HumanoidRearrangeController.set_framerate_for_linspeed(self, lin_speed: float, ang_speed: float, ctrl_freq: int) -> None

Set the linear and angular speed of the humanoid’s root motion based on the relative framerate of the simulator and the motion trajectory.

Parameters
lin_speed Speed of linear translation.
ang_speed Speed of the angular rotation (about Y-axis).
ctrl_freq Simulator step frequency. How many times does Simulator step to progress 1 second.

def habitat.articulated_agent_controllers.HumanoidRearrangeController.translate_and_rotate_with_gait(self, forward_delta: float, rot_delta: float)

Translates the character in the forward direction and rotates the character

Parameters
forward_delta how much to move forward or backward
rot_delta how much to rotate (in radians)