Skip to content

Add physical, hybrid, dual and binocular gaze to isaaclab_fovi - #9183

Open
nblauch wants to merge 40 commits into
isaac-sim:mainfrom
nblauch:feat/isaaclab-fovi-stereo-vergence
Open

nblauch wants to merge 40 commits into
isaac-sim:mainfrom
nblauch:feat/isaaclab-fovi-stereo-vergence

Conversation

@nblauch

@nblauch nblauch commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follows #9074, which added isaaclab_fovi. This PR now carries all of the active-gaze work: it includes #9181 (gaze modes, now a draft), which was reviewed on its own, and adds binocular gaze on top. Both were first reviewed in the fork, as nblauch#6 and nblauch#7.

Following FOVI-Dex, it lets a policy turn a camera on a pan-tilt mount as well as the retina inside it, and fixate a point with two foveated eyes on one head. Until now the gaze action could only turn one camera's retina (software gaze). The foveated-camera example's new --stereo mode shows binocular gaze.

Fixes to main. Three changes fix bugs in gaze_teacher_labels from #9074, listed under Fixed in the changelog: it rendered a frame for every label (see Teacher pose reads), a tracked mount's teacher aimed from the mount of the step before (see Mount updates), and a target naming the asset's only body raised a TypeError, since Isaac Lab resolves body ids that cover every body to a slice.

Gaze modes (isaaclab_fovi.mdp)

GazeActionCfg.mode chooses what the gaze actions turn:

  • "software" (the default, unchanged): the retina.
  • "physical": the rig's joints; each step adds to their last targets, so a lagging head still reaches every command.
  • "hybrid": the retina at once, while the rig turns the camera after it by at most GazeRigCfg.max_step_deg per step and the fixation holds in the world.
  • "dual" (experimental): four actions, the joints as in physical gaze and then the retina, independently.

The GazeAction docstring and the Foveated Camera page describe each mode in full. GazeRigCfg names the articulation and its pan and tilt joints. The rig modes need mount="tracked" and a camera without image roll. With a rig, gaze_state reports the fixation's direction from the rig's zero pose, the head's turn composed with the retina's, so the observation means the same in every mode. In physical gaze the retina stays where the gaze action leaves it, on the optical axis, unless something sets it directly with FoveatedCamera.set_gaze_angles; in hybrid gaze such a call starts a new fixation, which FoveatedCamera.gaze_writes lets the action tell apart from its own writes.

gaze_teacher_labels labels from where the next step starts: in hybrid gaze the software gaze re-aimed at its held fixation, and in physical gaze the head's commanded pose, so it never repeats a turn the head has made or has yet to make. Its target body may also be named when it is the asset's only body.

  • Teacher targets in the world. gaze_teacher_labels takes target_w, a function of the environment that returns each environment's target point, as an alternative to target_cfg. A target chosen per environment, such as the object a command picks among several, is not a point fixed to one asset.
  • Teacher pose reads. The teacher took the camera's position from camera.data, and reading a camera's data updates its image, so labelling rendered a frame; a policy that observes every fourth control step and labels every step rendered four frames for each one it used. The teacher now reads the new FoveatedCamera.mount_pos_w, which update_mount refreshes.

Mount updates. FoveatedCamera.update_mount() reads the camera's pose and returns its mount. A lazily updated camera reads its pose only when its data is read, so without it hybrid gaze aimed from the mount of a step ago and the head never settled. The tracked-mount teacher from #9074 had the same one-step lag and now uses it too.

Tracked mounts on Isaac RTX. A tracked mount needed a renderer that turns the camera's pose by the gaze, so the rig modes ran only on Newton and OVRTX. An Isaac RTX camera holds its gaze in its prim, relative to the prim's parent, so it already follows a moving mount; only the recorded mount was missing. update_mount now reads it back from the prim, without the gaze, and mount="tracked" works with every renderer.

Binocular gaze (isaaclab_fovi.mdp)

  • BinocularGazeActionCfg moves two eyes with three actions: the version, their shared line of sight (tilt, pan), and the vergence, the angle between their lines of sight. Each eye turns from the version by half the vergence, toward the other eye, in the plane that holds the version and the baseline, so the two lines of sight always meet; the farther the fixation, the smaller the vergence.
  • The version moves as a single camera's gaze does in "software", "physical" or "hybrid" gaze; the vergence always turns the retinas. Both are in field radii, and the vergence stays between zero (parallel) and vergence_limit.
  • binocular_gaze_state observes the version, the vergence and their velocities; with a rig, the version is its direction from the rig's zero pose, as for gaze_state.
  • binocular_gaze_teacher_labels labels the actions that fixate a point with both eyes: the version bisects the eyes' lines of sight to it and the vergence is their angle. The decomposition is exact, since the two lines of sight are symmetric about their bisector. Like gaze_teacher_labels, it starts from where the next step does, takes target_w, reads both eyes' positions from mount_pos_w without rendering, and checks each eye's visibility with its own camera.
  • binocular_gaze_angles turns a version, a vergence and the baseline between the eyes into each eye's gaze without an action term, through the same Warp function as the action's step, so code outside a manager-based environment can drive two foveated cameras with the same geometry.
  • The eyes need one body to carry them (their prims share a parent), parallel optical axes, and the same retina, on any renderer: Newton, OVRTX or Isaac RTX. The rig modes also need eyes without image roll.
  • The gaze actions write the rig's joint targets with a persistent joint-id array. A list became a new device array on every write, and with cameras rendering, a captured Newton physics step faulted on that freed memory.

Each gaze mode has its own Warp kernel, only hybrid gaze allocates the fixation it holds, and a Warp kernel resets the reset environments.

Pan-tilt mount (isaaclab_fovi.assets)

PAN_TILT_CFG is FOVI-Dex's two-joint pan-tilt mount, with no visual geometry. spawn_pan_tilt builds it in the stage, its three links and its fixed, pan and tilt joints, so the package ships no USD and nothing has to be hosted on Nucleus. It runs with or without Kit. PAN_TILT_CAMERA_OFFSET places a camera on its tilting link, and PAN_TILT_STEREO_OFFSETS two eyes 6.5 cm apart. Its drives are about critically damped and settle in about 0.3 s; their armature carries the inertia, since the links alone are too light for a stable stiff drive at a 120 Hz physics step on MJWarp. The mount leaves gravity on: Newton reads one body's disable_gravity as the whole scene's.

Example

isaaclab example foveated-camera keeps its single camera and software gaze. With --stereo it looks at the same YCB scene through two eyes 6.5 cm apart, which binocular_gaze_angles aims by a version and a vergence:

  • Below the viewer's Camera Source selector, sliders set the version (tilt, pan) and the vergence; I/J/K/L and drags in the eyes' window turn the version, and U/O converge and diverge the eyes. --target fixates an object as the binocular teacher would, and a "Gaze to next object" button glides both eyes onto the next object, the version and the vergence arriving together.
  • The viewer opens on a perspective view from beyond the objects that draws each eye as an eyeball turned with its gaze, its line of sight, and the point where they meet; a checkbox hides that overlay. A window shows both eyes' cortical views side by side, and the camera menu offers each eye.
  • The eyeball is FOVI-Dex's (examples/assets/active_camera_eyeball.usda, 0.8 MB in Git LFS, plain preview-surface materials and no textures). It stays beside the examples until it is uploaded to Nucleus. The viewer draws it as mesh instances, so the eyes' own images never see it.

Both modes now light the scene by renderer. Since #9165, Newton cameras read a dome light's intensity as linear radiance, so the RTX-scale dome (900) washed their images out to white; Newton now gets 1, and OVRTX and Isaac RTX keep 900. Core tasks with RTX-scale domes, such as reach and cabinet, may be washed out on Newton cameras the same way.

The separate foveated-stereo example from earlier revisions of this PR is gone, so isaaclab itself is unchanged.

Docs

"Gaze modes" and "Binocular gaze" sections on the Foveated Camera page, each with a config example and a figure (below), plus API entries for GazeRigCfg, binocular gaze, binocular_gaze_angles and isaaclab_fovi.assets. The Binocular gaze section shows how to run foveated-camera --stereo.

Gaze modes

Each mode on the pan-tilt mount, simulated with Newton's MJWarp solver at a 30 Hz policy step: the policy pans 4.5° left three times. In hybrid gaze the fixation jumps at once and holds while the head takes over from the retina.

Binocular gaze

Top: both eyes' 128 × 128 images at the end of each fixation. The fixated object sits in both foveas, while nearer or farther objects fall in different places in the two eyes. Below: the version jumps to each object while the head turns after it, and the vergence follows the object's distance. Hybrid gaze holds the version's direction rather than a point, and turning the head moves the eyes, so for near objects the teacher keeps adjusting the version and vergence while the head turns.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Release backport

  • Backport this pull request to the active release branch after it merges into main

Validation

At 250824d (the later commit adds the demo's eyeballs and controls; its glide was checked headless through all 17 objects, ending each with the lines of sight within 0.3 mm of the object, and the 56 simulator-free cases still pass after merging main):

  • Simulator-free: the 56 cases in test_active_gaze.py, test_camera_gaze.py and test_camera_cfg.py pass. New in test_active_gaze.py:
    • one kernel step per rig mode, and the dual observation against quaternion composition;
    • through GazeAction itself, a hybrid gaze set on the camera starting a new fixation, the hybrid teacher after a head turn, and the physical teacher on a tilted head with a turn already queued;
    • a target body named by a slice, and a world-point target reaching the gaze term with its offset;
    • for binocular gaze, the lines of sight meeting at the vergence's angle in one plane with the baseline, the vergence's limits, hybrid version with the head following, the teacher's labels for a point ahead and one behind, the physical and hybrid teachers after head turns, and the rejection of eyes on two bodies;
    • binocular_gaze_angles against the action's step;
    • the rig, action and binocular config checks.
  • All 11 Newton and Isaac RTX render cases pass; the four OptiX cases skip without optix. Two new cases run on both renderers:
    • test_hybrid_gaze_turns_the_head_onto_the_fixation pans three steps without reading the camera between steps. It checks that the retina leads the head, that the head and the camera's world axis end on the fixation with the retina back on the optical axis, and that after a reset the gaze and its observation are zero and the next step commands the rig's default pose. It fails without update_mount.
    • test_binocular_gaze_fixates_a_near_point_with_both_eyes steps the stereo head with the teacher's labels toward a point 0.4 m away and 15° to the left. It checks that both optical axes pass within 1 mm of the point, that the head carries the version and the vergence matches the distance, and that a reset restores parallel lines of sight. Flipping the vergence's direction in the kernel fails it and the vergence unit test.
  • foveated-camera --stereo, built headless on Newton and on Isaac RTX: after fixating three objects 0.5 m to 1 m away, steering, and setting the eyes parallel, the measured angle between the lines of sight equals the vergence and their bisector the version to within 0.0001°, and the lines meet within 0.2 mm of each object. Both it and the single-camera mode render normally on Newton and open in the Newton viewer.
  • The joint-id fix: with list ids, 180 steps of the binocular scene in physical or hybrid gaze, rendering both eyes with CUDA graphs on, faulted in the first steps; with mask writes, full-buffer writes or a persistent id array they run to the end. The pre-merge commit ad23446 faulted the same way.

Earlier, with the converted USD mount, whose links, masses, limits and drives the spawner reproduces:

  • Rollouts of all four modes on Newton + Warp reach the commanded 13.5° (physical settles at 13.47°).
  • FOVI-Dex's clutter-lift task, moved onto this gaze action: its render smoke passes with software and physical gaze on Newton + Warp and on PhysX + Isaac RTX, and a policy acting in four-step chunks renders once per chunk.
  • The docs build passed with warnings as errors.

Not rerun: OVRTX, the standalone-script smoke test, the contrib PPO cases, and the docs build since the last changes (the Binocular gaze section and the isaaclab_fovi.assets and isaaclab_fovi.mdp API pages).

Rig step cost. One rig gaze step with one kernel and a runtime mode (806a5ee) and with one kernel per mode, which also composes the head and retina rotations (b8c47ef), on an RTX 6000 Ada with Warp 1.17 and random actions and joints. Each kernel is launched 10 times to warm up, then 100 launches are captured in a CUDA graph, replayed 5 times, and timed over 200 replays.

Environments Mode 806a5ee b8c47ef
4,096 physical 2.53 µs 2.73 µs
4,096 hybrid 3.20 µs 3.49 µs
4,096 dual 2.35 µs 2.49 µs
65,536 physical 2.78 µs 3.24 µs
65,536 hybrid 3.94 µs 4.31 µs
65,536 dual 2.73 µs 3.17 µs

Launched from Python, either takes about 13 µs a step, which is launch overhead. Hybrid gaze reads the camera's pose each step (update_mount), which a camera read for its image that step would have done anyway.

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request, or run-ci ovstage to include kitless OVStage rendering tests for that run.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Every foveated camera adds a collapsing section to the Newton viewer's side
panel with gaze tilt and pan sliders that follow the camera's gaze, a center
button, and a discrete log-spaced cmf_a selector (viewer_gaze_controls,
viewer_cmf_a_values). Newton cameras with a fixed sample count change cmf_a at
runtime through FoveatedCamera.set_cmf_a; other renderers show it as fixed.

The foveated camera example puts the eye in the viewer's scene-camera slot,
covers the view with the sphere and retina comparison, and steers the gaze by
dragging or with I/J/K/L. The comparison redraws only when the viewer shows a
new eye frame and reuses that frame, so OVRTX sampling noise no longer makes it
flicker in a still scene.
GazeActionCfg.mode chooses what the gaze actions turn: the retina
(software, the default), the joints of a rig that carries the camera
(physical), the retina at once while the rig follows and takes over
(hybrid), or both independently with four actions (dual, experimental).
GazeRigCfg names the rig's articulation and joints; every rig mode needs
a tracked mount.

One Warp kernel steps every mode. Physical and dual steps add to the last
joint targets, so a lagging head still reaches each command. Hybrid aims
the software gaze back at the fixation it holds in the world each step,
and steps the head toward it by at most max_step_deg.

FoveatedCamera.update_mount reads the camera's pose before a lazily
updated camera renders. Hybrid gaze and the tracked-mount teacher aim
from it, so they no longer use a mount a step old when nothing has read
the camera's image yet.

isaaclab_fovi.assets adds PAN_TILT_CFG, a two-joint pan-tilt mount with
about critically damped drives that is stable on MJWarp at 120 Hz. It
leaves gravity on, since Newton reads one body's disable-gravity flag as
the whole scene's.

The Foveated Camera page gains a Gaze modes section, with a figure of
the four modes on the mount. The tests cover each mode's kernel step and
config checks, and one Newton case drives hybrid gaze through an
environment without reading the camera between steps.
@nblauch
nblauch requested a review from a team November 24, 2026 03:40
@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Nov 24, 2026
@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge based on the reviewed code.

Summary

Adds binocular gaze with a shared viewing direction and an angle between the eyes.

  • A foveated camera can turn its retina, a head, or both.
  • Two foveated eyes can aim together and converge on nearby points.
  • Gaze teachers can aim at world points and read fresh camera poses.
  • The stereo example guides two eyes between near and far objects.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Target[World target] --> Teacher[Binocular teacher]
    Teacher --> Actions[Version and vergence actions]
    Actions --> Gaze[Binocular gaze step]
    Mount[Current head pose] --> Teacher
    Mount --> Gaze
    Gaze --> Left[Left retina]
    Gaze --> Right[Right retina]
    Gaze --> Head[Physical or hybrid head targets]
Loading

Reviews (4) · Last reviewed commit: "Build the pan-tilt mount in code instead..." · Reviewed by Greptile

Comment on lines +158 to +161
current = version[i]
step = wp.vec3f(
wp.clamp((desired[0] - current[0]) / step_size, -1.0, 1.0),
wp.clamp((desired[1] - current[1]) / step_size, -1.0, 1.0),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Head motion gets counted twice

In hybrid mode, the teacher subtracts the previous step's version from a direction measured against the current mount. The head moves between those measurements. Then process_actions re-aims the held direction against the current mount before applying the label, counting the head's turn twice.

For example, if the version was 4.5° and the head advances 3°, the teacher requests −3° even when the target has not moved. Applying that label moves the gaze away from the target. Compute the teacher's current version from the held direction and current mount, as the step does.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b. The teacher now labels the version from where the next step starts: in hybrid gaze, the version re-aimed at the held fixation for the head's turn, not the last step's version. A new test holds a fixation on the target after a 3° head turn with a stale stored version and checks the version label is zero. The single-camera teacher in #9181 had the same double count and is fixed there in 0d2f7da.

if target_cfg.body_names is None:
positions, orientations = data.root_pos_w.warp, data.root_quat_w.warp
else:
body = target_cfg.body_ids[0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Named body targets crash

target_cfg.body_ids can be slice(None), not an index list. SceneEntityCfg makes that change when the selected names cover every body. Selecting a rigid object's only body by name therefore reaches this branch and raises TypeError at body_ids[0], stopping observation computation.

Handle the slice explicitly, or resolve and store one body index when the teacher is created.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b: the teacher resolves its body through target_body_index (added to the gaze module in #9181, 0d2f7da), which takes the slice's start when the named bodies cover the whole asset. The single-camera teacher had the same body_ids[0] and uses it too; a test covers the slice.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Design and architecture (1), Scope and over-engineering (5), Compatibility and deprecation (2), Implementation (5), Style consistency (8), Test quality (1). Other reviewed categories look good.

  • PR description: The stacked scope is disclosed; shorten repeated geometry prose and provide a baseline/candidate mount-refresh benchmark with revisions, command, hardware, backend, environment count, warmup, and per-step latency.
  • Design and architecture: Rig-field validation belongs in GazeRigCfg.validate_config(); placing it in action consumers leaves standalone rig validation incomplete and splits ownership.
  • Scope and over-engineering: Minimal implementation: Keep binocular_gaze.py for its stateful action contract, pan_tilt.py for reusable asset configuration, assets/init.py as lazy exports, and foveated_stereo.py as the entry point; extend gaze.py and gaze_cfg.py, sharing rig transitions and deleting duplicate vergence storage, intermediate point launches, and unused observations. Suggested PR breakdown: (1) single-eye modes, mount refresh, and mount asset, validated by gaze tests; (2) binocular geometry, stereo configuration, example, and docs, validated by fixation and CLI launch.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: inserting mode and rig shifts positional GazeActionCfg arguments without a transition; append those fields, and preserve float32 initial raw_actions rather than inheriting Torch's default dtype.
  • Implementation: Hybrid labels subtract the previous software version, while stepping first compensates for head motion; compute labels from the compensated version to avoid overcorrecting a held target.
  • Style consistency: The new assets package eagerly imports configuration instead of using the required lazy-export stub; declare exports in init.pyi and call lazy_export() to preserve the package import convention.
  • Test quality: The added unit and physical-fixture cases protect distinct behavior, but held_valid assertions duplicate observable hybrid proof or preserve private dual bookkeeping; remove those assertions.

Significant concerns. Posted 22 inline findings.

Automated review; human maintainers own approval decisions.

verge = angle / field_radius_deg
ok = (
project_direction(left, camera)[2] > 0.5
and project_direction(right, camera)[2] > 0.5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Project through the right camera

Both visibility checks use the left camera's projection parameters. Equal field radii and image rotation do not ensure equal calibration, so a right-eye-invisible target can be labeled valid. Use right-eye projection parameters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b: each eye's visibility is checked with its own camera's projection.

)
step = wp.vec3f(0.0, 0.0, 0.0)
if ok:
current = version[i]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Compensate version before labeling

After the head moves, the teacher subtracts the previous software version, but the step re-aims it before applying the label. A held target is overcorrected. Compute labels from that compensated version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b. The teacher now labels the version from where the next step starts: in hybrid gaze, the version re-aimed at the held fixation for the head's turn, not the last step's version. A new test holds a fixation on the target after a 3° head turn with a stale stored version and checks the version label is zero. The single-camera teacher in #9181 had the same double count and is fixed there in 0d2f7da.

# The quaternions' dot product is +-1 for one orientation.
if (1 - (mount_left * mount_right).sum(-1).abs()).amax() > 1e-5:
raise ValueError("Both eyes of a binocular gaze need parallel optical axes.")
self.baseline = self._baseline(mount_left[0], left.data.pos_w.torch[0], right.data.pos_w.torch[0])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Enforce a stable shared baseline

The baseline is measured only in environment zero at construction. Eyes on separate moving bodies can initially pass the orientation check, then use a stale baseline. Enforce their shared-body constraint or update per-environment baselines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b: the term now rejects eyes whose prims do not share a parent, since the version, the vergence and the baseline assume one rigid head. A test builds the term with eyes on two heads and checks the error.

:class:`~mdp.BinocularGazeActionCfg` moves two foveated cameras on one body with three actions: the version, their
shared line of sight (tilt, pan), and the vergence, the angle between their lines of sight. Each eye turns from the
version by half the vergence toward the other, in the plane of the version and the baseline, so the lines of sight
always meet. The version moves as a single camera's gaze does in ``"software"``, ``"physical"`` or ``"hybrid"``

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Qualify the intersection guarantee

The supported zero-vergence state has parallel sight lines from distinct eyes; they do not always meet. Qualify this claim for positive vergence here and in the binocular module documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b, in the module docstring and on the page: with any vergence above zero the lines of sight meet; at zero they are parallel.


.. code-block:: bash

uv run --extra fovi [--extra ovrtx] isaaclab example foveated-stereo [renderer=ovrtx]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Show runnable example commands

The Bash block contains literal bracketed alternatives and cannot be run as shown. Give separate default and OVRTX commands.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b: the page gives the Newton and OVRTX commands on separate lines.

class_type: type[GazeAction] | str = "{DIR}.gaze:GazeAction"
asset_name: str = MISSING
"""Scene name of the foveated camera whose gaze the action moves."""
mode: str = "software"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve positional configuration arguments

Adding mode and rig before step_size rebinds existing positional GazeActionCfg arguments. Append the fields instead, or make only the new fields keyword-only while preserving the old constructor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as answered on #9181: Isaac Lab configs are built with keywords, and mode and rig sit beside asset_name because they decide what the other fields mean.

def validate_config(self):
"""Reject invalid steps, limits and modes, and rig settings that a mode cannot use."""
for name in ("step_size", "gaze_limit", "vergence_limit"):
value = getattr(self, name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Access declared fields directly

The three validated fields are known attributes; getattr adds reflection contrary to the direct-access rule. Iterate over explicit name/value pairs as the adjacent GazeActionCfg validator does.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 030f94b: the validator iterates over explicit name and value pairs.

_validate_rig(self.rig)


def _validate_rig(rig: GazeRigCfg) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Design Architecture — Give rig validation one owner

Validating GazeRigCfg alone misses constraints that both action configs check through this helper. Move rig-field checks into GazeRigCfg.validate_config() and use that hook from its consumers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the rebase onto #9181, which made this change for single-camera gaze too. GazeRigCfg.validate_config owns the rig checks, and both action configs call it.

raise ValueError(f"GazeRigCfg.max_step_deg must be positive and finite, got {rig.max_step_deg!r}.")
if len(rig.joint_names) != 2 or len(set(rig.joint_names)) != 2:
raise ValueError(f"GazeRigCfg.joint_names must name two joints, got {rig.joint_names!r}.")
if any(sign not in (-1.0, 1.0) for sign in rig.joint_signs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Require exactly two joint signs

An empty joint_signs tuple passes this value-only check, despite the two-joint contract, and fails when constructing the Warp vector. Check its length before checking sign values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the rebase onto #9181, which made this change for single-camera gaze too.

# The retina turns at once; the head steps toward it by at most HEAD_STEP.
torch.testing.assert_close(rig.angles[0], torch.tensor([0.0, STEP * FIELD_RADIUS]))
torch.testing.assert_close(rig.targets[0], torch.tensor([HEAD_STEP * RADIUS_RAD, 0.0]))
assert rig.held_valid[0] == 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Remove private held-state assertions

The hybrid and dual tests assert held_valid bookkeeping rather than another observable contract; hybrid already checks its fixation effect. Remove both assertions so state refactoring does not break these tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the rebase onto #9181, which made this change for single-camera gaze too.

@nblauch
nblauch marked this pull request as draft November 24, 2026 03:59
Give each camera's side-panel widgets their own ImGui ID scope, so two
cameras' sliders no longer share state, and keep the camera's starting
cmf_a as a foveation option after a switch. Release the controls' buffers
when the camera is collected.

Clear the cmf_a retina cache when the camera initializes again, cache the
renderer's rays per value instead of rebuilding them on each switch, and
annotate the backend capability flags as ClassVar.

In the example, redraw the comparison when the gaze or foveation changes
as well as when the eye frame does, and cover the view once the window
exists and again only when the view is resized, so a moved window stays.

Test the RTX refusal without a simulator, run the runtime cmf_a render
case on Newton only, check that building a camera adds its controls, and
check that the sliders follow a gaze set elsewhere.
Subtract the head turn that physical gaze has already commanded from the
teacher's labels, so the teacher no longer queues the same turn again while
the head catches up. Report the rig's gaze as the head's turn composed with
the software gaze rather than their sum, start a new hybrid fixation when a
gaze is set on the camera directly, and reject rig modes on a camera with
image roll, whose tilt and pan do not follow the rig's joints.

Specialize the rig step per mode, allocate the fixation buffers only for
hybrid gaze, and reset the rig in a Warp kernel. Validate the rig's fields
in GazeRigCfg, including two joint signs, keep the initial raw actions in
float32, export isaaclab_fovi.assets lazily, drop the test-only
joint_targets property, and document software gaze on a moving camera and
dual gaze's four actions.
Redraw the camera view of every window the controls are in, not only the
one that changed. Write slider and steering changes into the camera's own
gaze buffer instead of separate copies, and let the example's comparison
window keep right and middle presses.

Give the retina cache a typed record, mark the runtime cmf_a helpers
private, put the example's main before its steering class, and annotate
the steering callbacks.
Count the camera's set_gaze_angles calls, so hybrid gaze starts a new
fixation after any direct gaze write, even one that repeats the angles it
holds, instead of comparing values. Label physical gaze from the head's
measured and commanded pose: the teacher composes the camera-frame target
with the measured head and subtracts the commanded head angles, which stays
exact on a tilted head.

Move the mode constants and gaze geometry to the top of the module and
reuse it in the teacher, describe max_step_deg as the target's offset from
the measured joints, annotate the config validators, drop a redundant copy
and comments, and drop the unused ground from the hybrid render case.
Test the hybrid setter and the physical teacher through GazeAction, check
the composed observation against quaternions, and group the rig test
helpers before the tests.
@nblauch
nblauch force-pushed the feat/isaaclab-fovi-stereo-vergence branch from 8a10552 to 213e71a Compare November 24, 2026 06:12
@nblauch

nblauch commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@isaaclab-review-bot review

@nblauch

nblauch commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

…dies

The hybrid step re-aims the software gaze at its held fixation before it
applies an action, so the teacher now labels from that re-aimed gaze. It
labelled from the gaze of the last step, which counts the head's turn
since then twice and asks for the same turn back.

A teacher's target body resolves through target_body_index, which also
accepts the slice SceneEntityCfg makes when the named bodies cover every
body, as naming a rigid object's only body does; that crashed before.
The rig step writes its joint targets through a shared Warp function.
@nblauch
nblauch force-pushed the feat/isaaclab-fovi-stereo-vergence branch from 213e71a to 030f94b Compare November 24, 2026 06:42
gaze_teacher_labels took a point fixed to one asset. A task whose target is
chosen per environment, such as the object a command picks among several,
could not use it. It now also takes target_w, a function of the environment
that returns each environment's target point in the world.
A tracked mount needed a camera whose pose update turns the gaze, so the
physical, hybrid and dual gaze modes ran only on Newton and OVRTX. An Isaac
RTX camera holds the gaze in its prim, relative to the prim's parent, so it
already follows a moving mount; only the recorded mount was missing.
update_mount now reads that mount back from the prim, without the gaze, and
the gaze action takes mount="tracked" with every renderer.

The hybrid-gaze render case runs on Isaac RTX as well as Newton.
The teacher took the camera's position from its data, and reading a
camera's data updates its image. A policy that observes every fourth
control step and labels every step rendered four frames for each one it
used.

update_mount already reads the pose alone. The teacher now calls it for
fixed mounts too and reads the position it refreshes, the new
FoveatedCamera.mount_pos_w.
nblauch added a commit to nblauch/IsaacLabTutorial that referenced this pull request Nov 24, 2026
isaaclab_fovi merged into Isaac Lab's main branch. The gaze teacher's world-point target, which this task uses, is under review in isaac-sim/IsaacLab#9183, so Isaac Lab is built from that pull request, and uv.lock is regenerated.

The lock holds the pull request's head as of now (030f94b), which does not yet have the teacher's world-point target or the camera's image-free pose read. Until they land there and the lock is refreshed, the ActiveGaze environment does not build from this lock.

The Microduck tasks target Isaac Lab 3.0.0 and do not run on this Isaac Lab.
The Newton visualizer let other code add controls only through its
register_ui_callback slots, so the foveated camera's gaze and foveation
controls sat in their own section under the Simulation header.

NewtonVisualizerBase.register_sensor_ui_callback adds a generic hook:
while a scene sensor is a window's camera source, each callback draws in
the Camera Sensor section, after its channel and environment controls,
with that sensor. The environment controls move to _draw_sensor_envs so
that their early return for a single-environment sensor does not skip the
callbacks. Foveated cameras register through it and draw a "Foveated
Camera" group when the sensor is theirs.
The comparison window's header titled its two images "Viewing sphere" and
"Retina" and showed the CMF constant, which the foveation slider below the
Camera Source selector already shows; the right image is also the
cortical view rather than the retina. The window now shows the two images
side by side, and the example no longer needs PIL or NumPy.
…and example

The docs page and the foveated-camera example still placed the gaze and
foveation sliders in the side panel at large and called the camera's image
the retina. The Sampling section now names the published lattice image
the retina's cortical view, and the example's description, help text and
docstrings use that name and place the sliders below the Camera Source
selector, in the Camera Sensor section.
The cortical view belongs to the foveated camera, not to its retina; the
docs page and the foveated-camera example now say so.
The comparison composes the foveated camera's output image, which is in
cortical space; the retina is the sampling space it comes from.
…stereo-vergence

# Conflicts:
#	source/isaaclab_fovi/test/foveated_render_cases.py
…stereo-vergence

# Conflicts:
#	source/isaaclab/test/app/standalone_script_cases.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go to nucleus?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it instead in 4a6de25: spawn_pan_tilt now builds the mount in the stage (three links, a fixed root joint and the pan and tilt joints, with the same masses, limits and drives), so the package ships no USD and there's nothing to host on Nucleus. It runs with or without Kit, and the hybrid and binocular render cases pass on Newton and Isaac RTX with it.

spawn_pan_tilt authors the mount's three links and its fixed, pan and tilt joints in the stage, with the masses, limits and drives of the converted USD it replaces, so the package ships no asset and nothing has to be hosted on Nucleus. The links sit under base/pan_link/tilt_link instead of the converter's Geometry/world/pan_link/tilt_link.
@nblauch
nblauch marked this pull request as ready for review December 1, 2026 22:22
@nblauch nblauch changed the title Add binocular gaze with version and vergence, and a stereo example Add physical, hybrid, dual and binocular gaze to isaaclab_fovi Dec 1, 2026
@matthewtrepte

Copy link
Copy Markdown
Collaborator

high level question, do we need a separate isaaclab_fovi package inside of the isaaclab/source? was there a specific reason we added foveated camera support there, in a previous PR, and not within an existing package?

@matthewtrepte

Copy link
Copy Markdown
Collaborator

do you foresee other multi camera / lens cases in the future, beyond binocular / stereo? if so, it might make sense to impl a more generic multi len abstraction, and then implement binocular within that

Comment thread examples/sensors/foveated_stereo.py Outdated
EYE_HEIGHT = 0.5
"""Height of the head's base above the ground [m]; the head looks along +Y with +Z up, so +X is to its right."""

OBJECTS = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps we can construct this dictionary with more keys, to make the data more clearly defined

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted; i am refactoring the example around the baseline one, with stereo as a special case/input arg. will ping you when it's done.

@nblauch

nblauch commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

high level question, do we need a separate isaaclab_fovi package inside of the isaaclab/source? was there a specific reason we added foveated camera support there, in a previous PR, and not within an existing package?

i think it is mostly because this is still considered relatively experimental and requires an extra dependency (fovi, so is shipped as an extra). we can always move it around but that would be a separate PR.

do you foresee other multi camera / lens cases in the future, beyond binocular / stereo? if so, it might make sense to impl a more generic multi len abstraction, and then implement binocular within that

not really, this is a key use case that we want to highlight since it matches the humanoid form factor and it directly supports a downstream use case.

certainly others could be interesting (e.g. adding wrist cameras etc.) but those generally wouldn't be foveated and wouldn't be controlled by a joint vision policy, they would just be standard cameras attached to the body. since i don't see a real use case, it might be overengineering to add another abstraction. i think if there are other multi-camera cases, people can write their own wrapper classes and controllers on top of this. and if it becomes relevant, we can refactor later - how does that sound?

@matthewtrepte

Copy link
Copy Markdown
Collaborator

hm are these gaze action names standard or does this change introduce them?

The gaze actions passed the rig's joint ids as a list, which set_position_index turns into a new device array on every write. With cameras rendering, a captured Newton physics step then faulted on that freed memory (CUDA error 700), so the stereo example crashed in its first steps once the viewer showed a camera. Both actions now keep the ids in one device array.
The version-and-vergence geometry moves out of the binocular gaze step into one Warp function, eye_gazes, which the step and the new binocular_gaze_angles share. Given a version, a vergence and the baseline between the eyes, the helper returns each eye's gaze, as BinocularGazeAction aims them, so code outside a manager-based environment can drive two foveated cameras with the same geometry. A test checks it against the action's step.
With --stereo, the foveated-camera example looks at its YCB scene through two eyes 6.5 cm apart that binocular_gaze_angles aims by a version and a vergence. Side-panel sliders set both; I/J/K/L and drags in the eyes' window turn the version, and U/O converge and diverge the eyes. The viewer opens on a perspective view that draws each eye's line of sight and the point where they meet, and a window shows both eyes' cortical views side by side. The separate foveated-stereo example, its program entry, script case and changelog fragment are removed.

Both modes now light the scene by renderer: since Newton cameras read a dome light's intensity as linear radiance, the RTX-scale dome washed their images out to white.
foveated-camera --stereo now draws FOVI-Dex's eyeball at each eye, turned with its gaze, as viewer mesh instances that the eyes' own images never see. The asset sits in examples/assets until it is on Nucleus; its curve-drawn iris fibers and veins are left out, since the viewer draws lines through surfaces.

The binocular gaze controls move below the Camera Source selector, for every source, and gain a checkbox that hides the overlay and a button that glides both eyes onto the next object, left to right, with the version and the vergence arriving together. The lines of sight are black with a small black fixation sphere, the version limit widens to 88 degrees to reach the outermost objects, and the viewer opens on a view from beyond the objects at the eyes' height.
Replace the floating eyeballs in foveated-camera --stereo with a fixed
Galbot G1 whose two head lenses are the eyes. Only the neck moves: every
other joint is frozen into a standing pose with the arms held at the
waist. BinocularGazeAction in hybrid mode turns the head toward the
fixation and splits the rest between the eyes.

Copy the eyes' home mount pose instead of aliasing the live camera
buffer, which made the head drift to its joint limits. Add a foveation
slider that steps both eyes' cmf_a on the Newton Warp renderer, and
frame the viewer on the robot and the objects.
The example's eye already sets mask_to_sensor_fov, and the stereo eyes copy it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants