Implementation:Facebookresearch Habitat lab HumanoidPickPolicy
| Knowledge Sources | |
|---|---|
| Domains | Embodied_AI, Hierarchical_Reinforcement_Learning |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
HumanoidPickPolicy is a hierarchical RL skill policy that generates humanoid picking motions by moving the arm to an object, snapping the hand to it, and retracting, with a companion HumanoidPlacePolicy for placing objects.
Description
HumanoidPickPolicy extends NnSkillPolicy and implements the logic for a humanoid agent to pick up objects. It resolves the target object from PDDL skill arguments via _parse_skill_arg, maps the target entity to an index in the ordered entity list, and produces a humanoid_pick_action with the corresponding entity index and a grab flag. Skill completion is determined by the HasFinishedHumanoidPickSensor. The from_config class method constructs the policy by filtering the action space to only the relevant pick action. The companion HumanoidPlacePolicy inherits from HumanoidPickPolicy and overrides _parse_skill_arg to use RELEASE_ID instead of GRAB_ID, enabling object placement with the same motion infrastructure.
Usage
Use HumanoidPickPolicy as a skill within a hierarchical task planner (HRL) for humanoid rearrangement tasks. It is typically managed by a higher-level policy that selects which skill to execute based on a PDDL plan.
Code Reference
Source Location
- Repository: Facebookresearch_Habitat_lab
- File: habitat-baselines/habitat_baselines/rl/hrl/skills/humanoid_pick.py
- Lines: 21-206
Signature
class HumanoidPickPolicy(NnSkillPolicy):
GRAB_ID = 1
RELEASE_ID = 0
def __init__(
self,
wrap_policy,
config,
action_space,
filtered_obs_space,
filtered_action_space,
batch_size,
pddl_domain_path,
pddl_task_path,
task_config,
):
class HumanoidPlacePolicy(HumanoidPickPolicy):
def _parse_skill_arg(self, skill_arg):
Import
from habitat_baselines.rl.hrl.skills.humanoid_pick import HumanoidPickPolicy, HumanoidPlacePolicy
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| wrap_policy | Policy or None | Yes | Wrapped neural network policy (can be None for oracle skills) |
| config | DictConfig | Yes | Skill configuration containing action_name, skill_name, etc. |
| action_space | ActionSpace | Yes | Full action space of the environment |
| filtered_obs_space | Space | Yes | Observation space filtered for this skill |
| filtered_action_space | ActionSpace | Yes | Action space filtered to the humanoid pick action |
| batch_size | int | Yes | Number of parallel environments |
| pddl_domain_path | str | Yes | Path to the PDDL domain definition |
| pddl_task_path | str | Yes | Path to the PDDL task specification |
| task_config | DictConfig | Yes | Habitat task configuration |
Outputs
| Name | Type | Description |
|---|---|---|
| action_data | PolicyActionData | Contains the full action tensor with the pick action index and grab/release flag set, plus RNN hidden states |
Key Methods
from_config
@classmethod
def from_config(
cls, config, observation_space, action_space, batch_size, full_config
):
Factory method that constructs the policy from configuration, filtering the action space to the configured action name.
_is_skill_done
def _is_skill_done(
self, observations, rnn_hidden_states, prev_actions, masks, batch_idx,
) -> torch.BoolTensor:
Returns True when the HasFinishedHumanoidPickSensor indicates the pick action is complete.
_parse_skill_arg
def _parse_skill_arg(self, skill_arg) -> HumanoidPickActionArgs:
Parses PDDL skill arguments to determine the target entity index and grab/release action.
Usage Examples
Basic Usage
from habitat_baselines.rl.hrl.skills.humanoid_pick import HumanoidPickPolicy
# Typically constructed via from_config within HRL framework
pick_skill = HumanoidPickPolicy.from_config(
config=skill_config,
observation_space=obs_space,
action_space=action_space,
batch_size=num_envs,
full_config=full_config,
)
# Set the PDDL problem for entity resolution
pick_skill.set_pddl_problem(pddl_problem)
# Enter the skill with PDDL arguments
pick_skill.on_enter(
skill_arg=["target_obj", "agent_0"],
batch_idx=[0],
observations=observations,
rnn_hidden_states=rnn_states,
prev_actions=prev_actions,
skill_name="pick",
)