Implementation:Isaac sim IsaacGymEnvs AllegroKukaBase
| Knowledge Sources | |
|---|---|
| Domains | Robotic_Manipulation, Reinforcement_Learning |
| Last Updated | 2026-02-15 11:00 GMT |
Overview
AllegroKukaBase is the foundational VecTask subclass for all single-arm Allegro-Kuka dexterous manipulation tasks, setting up a 7-DOF KUKA arm with a 16-DOF Allegro hand for object manipulation in GPU-parallelized Isaac Gym environments.
Description
The AllegroKukaBase class in isaacgymenvs/tasks/allegro_kuka/allegro_kuka_base.py extends VecTask to provide the complete simulation infrastructure for single-arm dexterous manipulation. It configures a KUKA LBR iiwa robotic arm (7 DOF) combined with an Allegro hand (16 DOF across 4 fingers: index, middle, ring, and thumb), resulting in 23 total degrees of freedom. The class handles asset loading, environment creation with objects (cuboids, sticks, or default cubes), and the full physics simulation loop.
The observation pipeline in compute_observations() constructs a rich state vector including hand DOF positions and velocities, fingertip positions and orientations, object pose and velocity, and relative distances between fingertips and the object. The reward function compute_kuka_reward() implements a keypoint-based reward system that measures the distance between current and goal keypoint configurations, combined with lifting rewards, bonus thresholds, and penalty terms for dropping objects or excessive forces.
The class supports curriculum learning through configurable difficulty scaling, domain randomization via Isaac Gym's built-in randomization system, and privileged actions that allow direct object manipulation for training bootstrapping. Pre-physics and post-physics step methods handle action application (position or torque control), contact force processing, and success/failure detection with automatic environment resets.
Usage
Use AllegroKukaBase as the base class for implementing specific single-arm Allegro-Kuka manipulation tasks such as regrasping, reorientation, or throw-and-catch. Subclasses typically override the reward function, observation space, or reset logic to define task-specific behavior.
Code Reference
Source Location
- Repository: IsaacGymEnvs
- File: isaacgymenvs/tasks/allegro_kuka/allegro_kuka_base.py
- Lines: 1-1592
Signature
class AllegroKukaBase(VecTask):
def __init__(self, cfg, rl_device, sim_device, graphics_device_id,
headless, virtual_screen_capture, force_render):
"""Initialize arm+hand+object simulation with 23 DOF control."""
def create_sim(self):
"""Create Isaac Gym simulation with ground plane and environments."""
def _create_envs(self, num_envs, spacing, num_per_row):
"""Load KUKA+Allegro and object assets, create parallel environments."""
def pre_physics_step(self, actions):
"""Apply actions to arm and hand DOFs (position or torque control)."""
def post_physics_step(self):
"""Update state tensors, compute observations and rewards, handle resets."""
def compute_observations(self):
"""Build observation vector: DOF state, fingertips, object pose, goals."""
def compute_kuka_reward(self):
"""Keypoint-based reward: distance delta + lifting + bonus - penalties."""
def reset_idx(self, env_ids):
"""Reset specified environments with randomized initial conditions."""
Import
from isaacgymenvs.tasks.allegro_kuka.allegro_kuka_base import AllegroKukaBase
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| cfg | dict | Yes | Task configuration including env.asset.kukaAllegro (asset path), env.numEnvs, env.episodeLength, reward scale parameters (distanceDeltaRewScale, liftingRewScale, liftingBonus, etc.), and control mode settings |
| rl_device | str | Yes | Device for RL computations (e.g., "cuda:0") |
| sim_device | str | Yes | Device for physics simulation (e.g., "cuda:0") |
| graphics_device_id | int | Yes | GPU ID for rendering (-1 for headless) |
| headless | bool | Yes | Whether to run without visualization |
| actions | Tensor | Yes | Per-step action tensor of shape (num_envs, 23) or (num_envs, 26) if privileged actions enabled |
Outputs
| Name | Type | Description |
|---|---|---|
| obs_buf | Tensor | Observation tensor containing DOF positions, velocities, fingertip poses, object state, and goal information |
| rew_buf | Tensor | Per-environment scalar rewards combining distance, lifting, and bonus components |
| reset_buf | Tensor | Boolean tensor indicating which environments need resetting |
| extras | dict | Additional info including success flags, consecutive successes, and reward components |
Usage Examples
# AllegroKukaBase is not used directly but subclassed for specific tasks.
# Example: Creating a reorientation task
from isaacgymenvs.tasks.allegro_kuka.allegro_kuka_base import AllegroKukaBase
class AllegroKukaReorientation(AllegroKukaBase):
def __init__(self, cfg, rl_device, sim_device, graphics_device_id,
headless, virtual_screen_capture, force_render):
super().__init__(cfg, rl_device, sim_device, graphics_device_id,
headless, virtual_screen_capture, force_render)
# Task-specific initialization
def compute_kuka_reward(self):
# Override with reorientation-specific reward
super().compute_kuka_reward()
# Add orientation alignment bonus
# Register the task:
# isaacgymenvs.task_map["AllegroKukaReorientation"] = AllegroKukaReorientation