Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c80e7b
Run the tutorial on the Isaac Lab main branch
nblauch Nov 17, 2026
28d4fea
Build Isaac Lab from the isaaclab_fovi pull request and add a fovi extra
nblauch Nov 17, 2026
fdb2c55
Import the ActiveGaze task code from isaaclab_fovi
nblauch Nov 17, 2026
8d35c35
Rebuild the gaze action and numbered goals around single owners
nblauch Nov 17, 2026
fb8e2db
Define the ActiveGaze variants as plain configuration classes
nblauch Nov 17, 2026
44d496f
Move the gaze in field radii and pass degrees to the camera
nblauch Nov 17, 2026
bc4b72e
Import the ActiveGaze robot deployment from isaaclab_fovi
nblauch Nov 17, 2026
6fec14d
Build Isaac Lab from its pull request ref and lock the fovi extra
nblauch Nov 17, 2026
dd97e60
Sample real images with the trained retina in degrees
nblauch Nov 17, 2026
a9480ef
Rebuild sim2real on the spherical camera and the tutorial's sim2real …
nblauch Nov 17, 2026
2678465
Exit DINO after a configurable number of layers
nblauch Nov 18, 2026
22b0796
Describe each run in run.json and drive training from the resolved co…
nblauch Nov 18, 2026
a70cfa9
Deploy from run.json with gaze in field radii
nblauch Nov 18, 2026
e6ebebf
Fix issues found by training and inspecting in simulation
nblauch Nov 18, 2026
593341d
Record play and inspection videos with imageio-ffmpeg
nblauch Nov 18, 2026
9d7d55e
Apply the tutorial's lint rules to the imported active-gaze code
nblauch Nov 18, 2026
113568a
Update the tests to the active-gaze redesign
nblauch Nov 18, 2026
7726783
Document the ActiveGaze task
nblauch Nov 18, 2026
f845c3b
Render OVRTX path-traced with a white background and a key light from…
nblauch Nov 18, 2026
7e6c2ca
Cast the same shadows on Newton and OVRTX
nblauch Nov 18, 2026
072efe3
Light the ActiveGaze scene with the tutorial's own lights
nblauch Nov 18, 2026
e61b023
Lock Isaac Lab at the pull request's latest commit
nblauch Nov 18, 2026
885b283
Import the PhysX configuration from isaaclab_isaacsim
nblauch Nov 24, 2026
7b4ea97
Follow RSL-RL's reworked PPO interfaces
nblauch Nov 24, 2026
61e4ba2
Move the gaze onto isaaclab_fovi's gaze action
nblauch Nov 24, 2026
34aa666
Select the Newton renderer as newton_warp
nblauch Nov 24, 2026
1eda8a1
Pin OVRTX to the release Isaac Lab uses
nblauch Nov 24, 2026
b1f7100
Describe the gaze as isaaclab_fovi's in the ActiveGaze guide
nblauch Nov 24, 2026
00a9570
Build Isaac Lab from the binocular gaze pull request
nblauch Nov 24, 2026
8135c96
Lock Isaac Lab at the pull request's latest commit
nblauch Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ uv run isaaclab zero_agent --task IsaacTutorial-Place-Vial-SO101 --num_envs 8 --
| --- | --- | --- |
| `IsaacTutorial-Place-Vial-SO101` | Full state | PPO |
| `IsaacTutorial-Place-Vial-SO101-Camera` | Wrist RGB (2 frames, 64×48) + proprioception | Distillation from a state teacher, or PPO from scratch |
| `IsaacTutorial-Place-Vial-SO101-ActiveGaze` | Foveated scene camera whose gaze the policy moves + proprioception | PPO with a gaze teacher; see [docs/ACTIVE_GAZE.md](docs/ACTIVE_GAZE.md) |

Add `presets=sim2real` to either task to enable robot-transfer randomization. The physical randomization is
identical in both tasks, so a teacher and its student train under the same physics. See
Expand All @@ -105,7 +106,7 @@ identical in both tasks, so a teacher and its student train under the same physi
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101 --num_envs 4096 --visualizer none presets=newton_mjwarp

# Camera student, distilled from the teacher checkpoint
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/to/state/model_799.pt --visualizer none presets=newton_mjwarp,newton_renderer
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/to/state/model_799.pt --visualizer none presets=newton_mjwarp,newton_warp
```

During distillation the student acts and the frozen teacher labels every state it visits. The labels are
Expand All @@ -116,7 +117,7 @@ images and proprioception as the student; the critic sees the privileged state.
iterations.

```bash
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --agent rsl_rl_ppo_cfg_entry_point --num_envs 1024 --visualizer none presets=newton_mjwarp,newton_renderer
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --agent rsl_rl_ppo_cfg_entry_point --num_envs 1024 --visualizer none presets=newton_mjwarp,newton_warp
```

### Evaluate
Expand All @@ -129,7 +130,7 @@ per-episode outcomes.
uv run isaaclab play --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101 --num_envs 1024 --checkpoint /abs/path/to/model.pt --visualizer none --external_callback isaaclab_tutorial.utils.evaluation.install_episode_counter presets=newton_mjwarp
```

To evaluate a camera policy, use the `-Camera` task with `presets=newton_mjwarp,newton_renderer`, and add
To evaluate a camera policy, use the `-Camera` task with `presets=newton_mjwarp,newton_warp`, and add
`--agent rsl_rl_ppo_cfg_entry_point` for one trained from scratch.

Do not pass `--deterministic`. On this pin it also enables Warp-wide deterministic physics, which overflows a
Expand Down Expand Up @@ -201,9 +202,11 @@ src/isaaclab_tutorial/
tasks/velocity/config/microduck/ Microduck environment, controls, and training configs
tasks/velocity/mdp/ walking commands, rewards, and task terms
utils/ evaluation, LEAPP export, real-robot scripts
active_gaze/ ActiveGaze task, training script and deployment (fovi extra)
checkpoints/microduck/ pretrained balance and walking policies
scripts/ Microduck evaluation and inspection tools
docs/SIM2REAL.md training for and deploying to the real robot
docs/ACTIVE_GAZE.md the ActiveGaze task, from install to the real robot
```

PhysX and OVRTX are available for sim-to-sim checks: install them with `uv sync --extra ovphysx --extra ovrtx`
Expand Down
97 changes: 97 additions & 0 deletions docs/ACTIVE_GAZE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Active gaze

`IsaacTutorial-Place-Vial-SO101-ActiveGaze` sees the scene through a fixed, foveated scene camera from Isaac Lab's
`isaaclab_fovi` package. Its retina samples densely where it looks and sparsely in the periphery, and the policy
moves the gaze while it moves the arm.

The task needs the `fovi` extra. `isaaclab_fovi` is on Isaac Lab's main branch, and the gaze teacher's world-point
target is still under review there (isaac-sim/IsaacLab#9183). Until that merges, the tutorial builds Isaac Lab from
that pull request. Two things follow:

- The Microduck tasks, written for Isaac Lab 3.0.0, do not run in this environment.
- Isaac Lab's main branch references a Git LFS file its server does not have, so skip LFS downloads when syncing:

```bash
GIT_LFS_SKIP_SMUDGE=1 uv sync --locked --extra fovi
```

In PowerShell, run `$env:GIT_LFS_SKIP_SMUDGE=1` first, then `uv sync --locked --extra fovi`.

## Variants

| Preset | Goal | Actor |
| --- | --- | --- |
| `numbered` (default) | The opening with the vial's number | CNN on the 64×64 retina, proprioception and gaze |
| `nearest` | Any opening, as in the state task | CNN on the 64×64 retina, proprioception and gaze |
| `dino_language` | The opening with the vial's number | Frozen foveated DINOv3 on the 128×128 retina, fused with an instruction |

The critic sees the privileged state, including the target opening, in every variant.

## Gaze

- The camera is an ideal square pinhole; the retina spans its field of view, so the gaze can reach anything the
camera sees.
- The gaze is `isaaclab_fovi`'s: `GazeAction` moves it in software, turning the retina within the fixed camera's
image, `gaze_state` observes it, and `gaze_teacher_labels` supervises it.
- Two of the eight actions move the gaze (tilt, pan). An action of 1 moves an angle by 0.1 field radii, a field
radius being half the retina's field of view, and the gaze stays within 1 field radius of the optical axis.
The actor observes the gaze and its velocity in the same units.
- The teacher looks at a point in the world that the task picks: the vial until the grasp, then the goal. The PPO
loss adds the teacher's gaze actions as labels (`agent.algorithm.oracle_weight`, 1.0);
`presets=no_gaze_supervision` turns this off.
- Episodes start the gaze at random, on the vial or the goal, or a few degrees off either
(`env.actions.gaze.mixed_resets`).

## Train

The task trains with its own script, because action chunking wraps the environment and the reset curriculum
needs its own runner:

```bash
uv run --extra fovi python -m isaaclab_tutorial.active_gaze.train train --output runs/numbered presets=numbered,newton_warp
```

Every argument that is not a script option is an Isaac Lab configuration override, as with `isaaclab train`.
Useful presets and overrides:

- `newton_warp` renders with Newton; the default is OVRTX path-traced RGB (`--extra ovrtx`). The faster
OVRTX Minimal modes (`minimal_full_mdl`, `minimal_diffuse_mdl`, with `_shadows` variants) draw no background.
- `sim2real` adds the tutorial's physical randomization, scene colours, a camera mount that moves each episode,
and photometric variation of the retina. The gaze stays relative to the moved mount, and its teacher aims from
it (`mount="tracked"`). On `dino_language`, the actor also learns to predict the mount's move.
- `chunking` makes each policy decision a plan of three control steps.
- `env.observations.vision.tokens.params.num_layers=N` runs only the first `N` DINO layers, to cut the cost of
perception while keeping pretrained features.
- `env.scene.eye.cmf_a_deg=…` changes how strongly the retina is foveated; a large value makes it nearly uniform.

Each run writes `run.json` next to its checkpoints. It records the overrides, the retina, the gaze and the control
rates. `--checkpoint path/model_N.pt` resumes a run with its saved overrides. A new override replaces the saved
value, and `presets=…,finetune` warm-starts at a lower learning rate. Add `--logger wandb` for W&B.

## Play and inspect

```bash
uv run --extra fovi python -m isaaclab_tutorial.active_gaze.train play --checkpoint runs/numbered/model_4999.pt --output runs/numbered_play
uv run --extra fovi python -m isaaclab_tutorial.active_gaze.train inspect --num_envs 4 --output runs/inspect presets=numbered,newton_warp
```

`play` builds the run's saved configuration; a `presets=` argument would replace the saved preset list. Both write
videos and frames that show a dense camera at the scene camera's pose next to the retina. `inspect`
sweeps the gaze through every reset category without a policy, and checks that resetting one environment leaves the
others alone.

## Deploy

The `dino_language` policy runs on the real robot through a LEAPP bundle. The bundle samples the real camera's
images on the simulator's retinal grid, so describe that camera as a `fovi.sensing.projection.CameraModel` in
JSON: `model` (`pinhole` or `fisheye`), `image_size` (height, width), `intrinsics` (fx, fy, cx, cy) and OpenCV
`distortion` coefficients.

```bash
uv run --extra fovi --extra leapp python -m isaaclab_tutorial.active_gaze.deployment.export --checkpoint runs/language/model_4999.pt --camera_model camera.json --output bundles/language
uv run --extra fovi --extra leapp --with "lerobot[feetech]==0.6.1" python -m isaaclab_tutorial.active_gaze.deployment.run --bundle bundles/language --joint-map joint_map.json --port /dev/ttyACM0
```

`run` drives the arm through LeRobot, the version the tutorial's own robot scripts use. It stays read-only unless `--execute` is given with a verified joint map and a start pose, as described in
[SIM2REAL.md](SIM2REAL.md). Without `--camera_model`, the export uses the simulated camera; such a bundle can be
checked in simulation with `train.py play --deployment_bundle`, but `run` refuses to execute it.
4 changes: 2 additions & 2 deletions docs/SIM2REAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101 --num_envs 4096 --checkpoint /abs/path/state/model_799.pt --visualizer none presets=newton_mjwarp,sim2real

# 3. Distill a camera student from that teacher under the same randomization.
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/sim2real_state/model_XXX.pt --visualizer none presets=newton_mjwarp,newton_renderer,sim2real
uv run isaaclab train --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/sim2real_state/model_XXX.pt --visualizer none presets=newton_mjwarp,newton_warp,sim2real
```

To evaluate in simulation, run play from home starts and count exactly one episode per environment. The
sim2real preset keeps its physics randomization during evaluation.

```bash
uv run isaaclab play --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/distillation/model_XXX.pt --visualizer none --external_callback isaaclab_tutorial.utils.evaluation.install_episode_counter presets=newton_mjwarp,newton_renderer,sim2real
uv run isaaclab play --rl_library rsl_rl --task IsaacTutorial-Place-Vial-SO101-Camera --num_envs 1024 --checkpoint /abs/path/distillation/model_XXX.pt --visualizer none --external_callback isaaclab_tutorial.utils.evaluation.install_episode_counter presets=newton_mjwarp,newton_warp,sim2real
```

## 2. Physical setup
Expand Down
16 changes: 12 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ generate-so101-resets = "isaaclab_tutorial.tasks.place_vial.reset.generator:gene
view-so101-resets = "isaaclab_tutorial.tasks.place_vial.reset.generator:view_main"

[project.optional-dependencies]
# The foveated camera (isaaclab_fovi) and the libraries of the ActiveGaze task.
fovi = ["isaaclab[fovi]", "transformers==5.19.0", "imageio-ffmpeg>=0.5"]
leapp = ["leapp==0.7.2"]
ovphysx = ["ovphysx"]
ovrtx = ["ovrtx==0.5.0.377615", "ovstage==0.1.1.355824"]
ovrtx = ["ovrtx==0.7.0.1794596436", "ovstage==0.4.0.1794520352"]
video = ["isaaclab[video]"]
viser = ["isaaclab[viser]"]
# Temporary compatibility pin: Isaac Lab's logger calls wandb.util.generate_id,
Expand All @@ -39,10 +41,16 @@ wandb = ["isaaclab[wandb]", "wandb==0.26.1"]
dev = ["codespell>=2.4", "pre-commit>=4.2", "pytest>=8.3", "ruff>=0.11"]

[tool.uv]
environments = ["sys_platform == 'linux' and platform_machine == 'x86_64'", "sys_platform == 'win32' and platform_machine == 'AMD64'", "sys_platform == 'linux' and platform_machine == 'aarch64'"]
# Isaac Lab pins transformers 5.10.4; the ActiveGaze language encoder (Cosmos3-Edge) first ships in 5.19.0.
override-dependencies = ["transformers==5.19.0"]
# Isaac Lab main requires pre-release hydra-core and omegaconf, and allows pre-releases the same way.
prerelease = "allow"
environments =["sys_platform == 'linux' and platform_machine == 'x86_64'", "sys_platform == 'win32' and platform_machine == 'AMD64'", "sys_platform == 'linux' and platform_machine == 'aarch64'"]

[tool.uv.sources]
isaaclab = { git = "https://github.com/isaac-sim/IsaacLab.git", branch = "release/3.0.0", subdirectory = "tools/wheel_builder" }
# The ActiveGaze task aims isaaclab_fovi's gaze teacher at a world point, which is under review in Isaac Lab
# (isaac-sim/IsaacLab#9183, on top of #9181). Until it merges, the tutorial builds Isaac Lab from that pull request.
isaaclab = { git = "https://github.com/isaac-sim/IsaacLab.git", rev = "refs/pull/9183/head", subdirectory = "tools/wheel_builder" }
ovphysx = { index = "nvidia" }
ovrtx = { index = "nvidia" }
torch = { index = "pytorch-cu130" }
Expand Down Expand Up @@ -83,7 +91,7 @@ section-order = [
]

[tool.ruff.lint.isort.sections]
isaaclab = ["isaaclab", "isaaclab_newton", "isaaclab_ov", "isaaclab_physx"]
isaaclab = ["isaaclab", "isaaclab_fovi", "isaaclab_isaacsim", "isaaclab_newton", "isaaclab_ov"]
"isaaclab-rl" = ["isaaclab_rl"]
"isaaclab-tasks" = ["isaaclab_tasks"]
"isaaclab-assets" = ["isaaclab_assets"]
Expand Down
11 changes: 11 additions & 0 deletions src/isaaclab_tutorial/active_gaze/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Active gaze for SO-101 vial placement: a foveated scene camera whose gaze the policy moves.

The retina samples the scene densely where it looks and sparsely in the periphery. A matched non-foveated model is
the same task with a large ``env.scene.eye.cmf_a_deg``. This package needs the ``fovi`` extra, which installs Isaac
Lab's ``isaaclab_fovi`` camera and the policy libraries.
"""

TASK_ID = "IsaacTutorial-Place-Vial-SO101-ActiveGaze"

RUN_FILE = "run.json"
"""Name of the file, next to a run's checkpoints, that describes what the run trained."""
103 changes: 103 additions & 0 deletions src/isaaclab_tutorial/active_gaze/agents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
"""PPO agents of the active-gaze variants, with gaze supervision by the teacher.

Presets: ``no_gaze_supervision`` turns the teacher's gaze loss off, ``chunking`` makes each decision a plan of three
control actions, ``finetune`` lowers the learning rate to warm-start from a checkpoint, and ``sim2real`` adds the
extrinsics head to the language agent.
"""

from isaaclab.utils import configclass

from isaaclab_rl.rsl_rl import RslRlCNNModelCfg, RslRlMLPModelCfg, RslRlOnPolicyRunnerCfg, RslRlPpoAlgorithmCfg

from isaaclab_tasks.utils import PresetCfg, preset

from .language import INSTRUCTIONS
from .learning.config import LanguageVisionActorCfg


@configclass
class GazeSupervisedPPOCfg(RslRlPpoAlgorithmCfg):
"""PPO with a loss that pulls the gaze actions toward the teacher's."""

class_name = "isaaclab_tutorial.active_gaze.learning.oracle_ppo:OraclePPO"
value_loss_coef = 1.0
use_clipped_value_loss = True
clip_param = 0.2
entropy_coef = 0.005
num_learning_epochs = 5
num_mini_batches = 8
learning_rate = preset(default=3e-4, finetune=3e-5)
schedule = "fixed"
gamma = 0.995
lam = 0.95
desired_kl = 0.01
max_grad_norm = 1.0
oracle_weight: float = preset(default=1.0, no_gaze_supervision=0.0)
"""Weight of the teacher's gaze loss."""
oracle_std: float = 1e-4
action_chunk_size: int = preset(default=1, chunking=3)
"""Control actions planned by each policy decision."""


@configclass
class ExtrinsicsPPOCfg(GazeSupervisedPPOCfg):
"""Gaze-supervised PPO that also trains the actor's head to predict the camera mount's move."""

class_name = "isaaclab_tutorial.active_gaze.pose_ppo:ExtrinsicsPPO"
extrinsics_weight: float = 0.05


@configclass
class ActiveGazePPORunnerCfg(RslRlOnPolicyRunnerCfg):
"""A CNN actor on the retina, proprioception and gaze; an MLP critic on the full state."""

seed = 42
# Keeps the rollout near the same control horizon when each decision plans three actions.
num_steps_per_env = preset(default=64, chunking=21)
run_name = ""
clip_actions = 1.0
finetune: bool = preset(default=False, finetune=True)
"""Warm-start from a checkpoint, allowing the extrinsics head to be new."""
experiment_name = "so101_vial_active_gaze"
max_iterations = 5000
save_interval = 100
obs_groups = {"actor": ["scene_rgb", "proprioception", "gaze"], "critic": ["critic"]}
algorithm = GazeSupervisedPPOCfg()
critic = RslRlMLPModelCfg(hidden_dims=[256, 256, 128], activation="elu", obs_normalization=True)
actor = RslRlCNNModelCfg(
cnn_cfg=RslRlCNNModelCfg.CNNCfg(
output_channels=[16, 32, 32], kernel_size=[5, 3, 3], stride=[2, 2, 2], activation="elu"
),
hidden_dims=[256, 128],
activation="elu",
obs_normalization=True,
distribution_cfg=RslRlCNNModelCfg.GaussianDistributionCfg(init_std=0.2, std_type="log", std_range=(0.05, 0.3)),
)


@configclass
class LanguageActorCfg(LanguageVisionActorCfg):
instructions = INSTRUCTIONS
distribution_cfg = ActiveGazePPORunnerCfg().actor.distribution_cfg
extrinsics_head: bool = preset(default=False, sim2real=True)


@configclass
class LanguagePPORunnerCfg(ActiveGazePPORunnerCfg):
"""A frozen-DINO and language actor; the extrinsics head and its loss come with ``sim2real``."""

actor = LanguageActorCfg()
algorithm = preset(
default=GazeSupervisedPPOCfg(use_mixed_precision=True), sim2real=ExtrinsicsPPOCfg(use_mixed_precision=True)
)
obs_groups = {"actor": ["proprio", "vision", "instruction"], "critic": ["critic"]}


@configclass
class ActiveGazeAgentCfg(PresetCfg):
"""Agents of the task variants in :class:`~.env_cfg.ActiveGazeEnvCfg`, selected by the same names."""

nearest = ActiveGazePPORunnerCfg()
numbered = nearest
dino_language = LanguagePPORunnerCfg()
default = numbered
Loading