Implementation:Facebookresearch Habitat lab ResetArmSkill
| Knowledge Sources | |
|---|---|
| Domains | Embodied_AI, Hierarchical_Reinforcement_Learning |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
ResetArmSkill is a hierarchical RL skill that moves a robot arm to a predefined rest joint configuration by computing proportional delta actions normalized by the initial displacement.
Description
ResetArmSkill extends SkillPolicy and implements a simple proportional controller to return the robot arm to a target rest state. Upon entering the skill (on_enter), it records the initial delta between the rest state and the current joint positions. The _internal_act method computes the current delta from the rest state, divides it by the maximum initial delta (clamped to avoid division by zero), and writes the result into the arm action slice of the full action tensor. This normalization ensures actions remain in [-1, 1] and naturally reduces in magnitude as the arm approaches the target. The skill signals completion (_is_skill_done) when the maximum absolute joint error falls below 0.05 radians. The rest joint state is read from config.reset_joint_state.
Usage
Use ResetArmSkill within a hierarchical RL framework to reset the robot arm to its rest position between manipulation subtasks. It is typically invoked by a high-level task planner after a pick or place action.
Code Reference
Source Location
- Repository: Facebookresearch_Habitat_lab
- File: habitat-baselines/habitat_baselines/rl/hrl/skills/reset.py
- Lines: 16-104
Signature
class ResetArmSkill(SkillPolicy):
def __init__(
self,
config,
action_space: spaces.Space,
batch_size,
):
Import
from habitat_baselines.rl.hrl.skills.reset import ResetArmSkill
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | DictConfig | Yes | Skill configuration containing reset_joint_state (list of target joint positions) |
| action_space | gym.spaces.Space | Yes | Full action space of the environment, must contain "arm_action" |
| batch_size | int | Yes | Number of parallel environments |
Outputs
| Name | Type | Description |
|---|---|---|
| action_data | PolicyActionData | Full action tensor with arm delta actions set to drive toward rest state, plus RNN hidden states |
Key Methods
on_enter
def on_enter(
self,
skill_arg: List[str],
batch_idxs: List[int],
observations,
rnn_hidden_states,
prev_actions,
skill_name,
) -> Tuple[torch.Tensor, torch.Tensor]:
Records the initial joint displacement from the rest state for normalization.
_is_skill_done
def _is_skill_done(
self, observations, rnn_hidden_states, prev_actions, masks, batch_idx
):
Returns True when the maximum joint error is below 0.05 radians.
_internal_act
def _internal_act(
self, observations, rnn_hidden_states, prev_actions, masks, cur_batch_idx,
deterministic=False,
):
Computes proportional arm actions normalized by the initial delta.
Usage Examples
Basic Usage
import gym.spaces as spaces
from habitat_baselines.rl.hrl.skills.reset import ResetArmSkill
# Construct the skill from config and action space
reset_skill = ResetArmSkill(
config=skill_config, # Must have reset_joint_state
action_space=env_action_space, # Must contain "arm_action"
batch_size=num_envs,
)
# Enter the skill
rnn_states, prev_actions = reset_skill.on_enter(
skill_arg=[],
batch_idxs=[0],
observations=observations,
rnn_hidden_states=rnn_hidden_states,
prev_actions=prev_actions,
skill_name="reset_arm",
)
# Execute the skill in a loop
while not done:
action_data = reset_skill.act(
observations, rnn_hidden_states, prev_actions, masks, cur_batch_idx
)
observations, rewards, dones, infos = envs.step(action_data.actions)