Skip to content

Add physical, hybrid and dual gaze to isaaclab_fovi - #9181

Draft
nblauch wants to merge 10 commits into
isaac-sim:mainfrom
nblauch:feat/isaaclab-fovi-gaze-modes
Draft

nblauch wants to merge 10 commits into
isaac-sim:mainfrom
nblauch:feat/isaaclab-fovi-gaze-modes

Conversation

@nblauch

@nblauch nblauch commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follows #9074, which added isaaclab_fovi. Reviewed in the fork as nblauch#6 while #9074 was open, and now rebased onto main.

Adds physical, hybrid and dual gaze to isaaclab_fovi's gaze action, following FOVI-Dex, so a policy can turn a camera on a pan-tilt mount as well as the retina inside it. Until now the gaze action could only turn the retina (software gaze).

Fixes to main. Three of the changes below 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, 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.

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.

Pan-tilt mount (isaaclab_fovi.assets). PAN_TILT_CFG is FOVI-Dex's two-joint pan-tilt mount (a 5 KB USD with no visual geometry), and PAN_TILT_CAMERA_OFFSET places a camera on its tilting link. 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. The repository ignores *.usda, so the file is force-added, as Isaac Lab's test USDs are; it could move to Nucleus instead.

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.

Added after the first reviews (the last three commits, cd4f34e, 8150e98 and f6bd99b), from moving FOVI-Dex's clutter-lift task onto this gaze action:

  • 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.
  • 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, and calls update_mount for fixed mounts too.

Docs. A "Gaze modes" section on the Foveated Camera page, with a config example and a figure of the four modes on the mount (below), plus API entries for GazeRigCfg and isaaclab_fovi.assets.

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.

Next. #9183, stacked on this PR, adds binocular gaze and a stereo vergence example.

Type of change

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

Validation

  • Simulator-free: the 75 cases under source/isaaclab_fovi/test and the 5 contrib PPO cases. New in test_active_gaze.py: one kernel step per rig mode, the dual observation against quaternion composition, and 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; plus a target body named by a slice, a world-point target labelled as an asset at that point is, and the rig and action config checks.
  • One new render case, test_hybrid_gaze_turns_the_head_onto_the_fixation, on Newton and on Isaac RTX, builds an environment with the mount and a foveated camera on it, pans three steps without reading the camera between steps, and checks that the retina leads the head, that the head and the camera's world axis end on the commanded 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.
  • All Newton and Isaac RTX render cases pass on main.
  • Rollouts of all four modes on Newton + Warp reach the commanded 13.5° (physical settles at 13.47°).
  • FOVI-Dex's clutter-lift task on this branch: 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 passes with warnings as errors (not rebuilt after the last three commits, which change one sentence of the page).

Rig step cost. One rig gaze step at 806a5ee (the first commit: one kernel with a runtime mode) and at b8c47ef (one kernel per mode, which also composes the head and retina rotations), 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. Physical and dual gaze no longer allocate hybrid's fixation buffers. 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

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.
@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The three requested commits appear safe to merge.

Summary

Reviewed the three requested commits: cd4f34e, 8150e98, and f6bd99b.

  • Gaze actions can turn the camera rig, the retina, or both.
  • Camera mounts can be refreshed without rendering an image.
  • Gaze teachers can label world points and account for the next gaze step.

No new actionable issues were found. The earlier repeated-command finding is fixed.

Reviews (3) · Last reviewed commit: "Read the camera's pose in the gaze teach..." · Reviewed by Greptile

@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 (3), Scope and over-engineering (4), API (1), Compatibility and deprecation (2), Implementation (2), Style consistency (4), Test quality (1).

  • PR description: Replace stationary-software and reset-pose claims with relative gaze and reset-target checks; retain template sections, and benchmark added pose refreshes using baseline/candidate revisions, workload, hardware, backend, runtime environment, environment count, warmup, and step latency.
  • Design and architecture: Hybrid control sends upright-image residuals directly to rig joints, so rolled images drive the wrong axes; convert the residual into rig coordinates.
  • Scope and over-engineering: Minimal implementation: Extend GazeAction, GazeActionCfg, GazeRigCfg, and FoveatedCamera; keep assets/pan_tilt.py for the packaged preset and assets/init.py for its lazy public contract. Delete the target accessor, inline the clamp, specialize modes, allocate fixation only for hybrid, and reuse the Warp reset path. Preserve configuration, mount refresh, control, actuator writes, and focused validation. Scope is cohesive; no split recommended.
  • API: The new assets package eagerly imports its preset instead of following the public lazy-export contract; use lazy_export() with an adjacent export stub.
  • Compatibility and deprecation: Breaking changes: inserted mode/rig fields shift positional GazeActionCfg arguments, and initial raw_actions follows Torch’s default dtype; append fields and preserve float32 so both old contracts remain functional.
  • Implementation: Adding head and retinal angles does not compose pan-tilt rotations, so combined-axis state and velocity misreport fixation; derive them from composed orientations.
  • Style consistency: Added gaze documentation incorrectly restricts software mode to stationary cameras and introduces two-action wording despite dual’s four-action input; document relative gaze and mode-dependent shapes.
  • Test quality: The config, mode, and physical-fixture cases protect distinct contracts, but held_valid assertions preserve private bookkeeping already exercised by observable fixation behavior; remove those assertions.

Significant concerns. Posted 17 inline findings.

Automated review; human maintainers own approval decisions.

tilt_base = targets[i, 1]
if mode == HYBRID:
# The head steps from where it is toward the fixation, at most head_step per coordinate.
turn = wp.vec2f(wp.clamp(soft[0], -head_step, head_step), wp.clamp(soft[1], -head_step, head_step))

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 · Design Architecture — Convert residual into rig coordinates

Hybrid uses upright-image tilt and pan directly as joint commands. With nonzero image_rotation_deg, the rig turns on the wrong axes and cannot follow the fixation. Transform the residual into the rig frame.

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 e3d1056 by rejecting the case: the rig modes now raise for a camera with nonzero image_rotation_deg, since a rolled image's tilt and pan do not follow the pan and tilt joints in any of them (physical and dual send the actions to the joints directly too). With no roll the image frame is the camera's, so the kernels drop the frame argument.


:attr:`~mdp.GazeActionCfg.mode` sets what the gaze actions turn:

* ``"software"`` (the default): the retina, inside a camera that does not turn.

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 — Describe tracked software gaze accurately

Software mode accepts mount="tracked" on a moving camera, so this stationary-camera description is false. Describe retinal gaze relative to the camera and correct the matching GazeAction entry.

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 e3d1056: the page and the GazeAction docstring describe software gaze relative to the camera's optical axis, with the camera free to move on a tracked mount.



@wp.func
def within(g: wp.vec2f, limit: wp.float32) -> wp.vec2f:

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 — Inline the single-use clamp

within is a public one-line helper for scaling already written inline in gaze_step_kernel. Inline the expression and remove the unnecessary helper.

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.

I went the other way in e3d1056: gaze_step_kernel now uses within (and a clamp_unit helper) instead of repeating the expression, so both kernels share one clamp.

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

Fields inserted before step_size shift the generated positional constructor, so existing positional bounds bind to mode and rig. Append new fields after the existing fields.

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.

Keeping this order. Isaac Lab configs are built with keywords, and mode and rig sit next to asset_name because they decide what the other fields mean, which reads better in the API docs.

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

A one- or three-element joint_signs value passes this check but fails later when constructing wp.vec2f. Validate its length with the other rig fields.

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 e3d1056: joint_signs must have exactly two entries, each 1 or -1.

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.
@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

@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 (2), Compatibility and deprecation (1), Implementation (1), Style consistency (6), Test quality (4). Other reviewed categories look good.

  • PR description: The title matches the modes, assets, and docs; shorten repeated mode explanations while preserving template sections, qualify physical-retina behavior after direct setters, and supplement measured kernel timings with revisions, reproducible workload commands, and warmup.
  • Design and architecture: Hybrid gaze compares angle values instead of detecting explicit camera writes, so unchanged-value setters retain the old fixation; track external setter writes.
  • Scope and over-engineering: Minimal implementation: Extend gaze.py, gaze_cfg.py, and FoveatedCamera; reuse gaze geometry and remove the second target copy, without adding control layers; keep assets/pan_tilt.py for the packaged asset contract and assets/init.py plus init.pyi for required lazy exports; the essential flow remains action processing, mount refresh, joint targets, observation, and teacher labels. Scope is cohesive; no split recommended.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: inserting mode and rig before existing GazeActionCfg fields changes positional binding without a deprecation bridge; append both fields after mount.
  • Implementation: Queued joint-angle differences do not equal camera-frame gaze differences on tilted heads, causing repeated teacher corrections; derive pending gaze from composed current and target head orientations.
  • Style consistency: max_step_deg incorrectly describes target changes rather than offsets from measured joints; correct that public contract, then fix declaration order, missing annotations, and redundant comments.
  • Test quality: Kernel-only pending-turn coverage and mocked teacher inputs miss failures in GazeAction.pending_head_turn; exercise that owner, use the real camera setter and an independent composition oracle, and remove unasserted terrain construction.

Significant concerns. Posted 15 inline findings.

Automated review; human maintainers own approval decisions.

soft = within(soft + clamp_unit(wp.vec2f(actions[i, 2], actions[i, 3])) * step_size, gaze_limit)
if wp.static(mode == HYBRID):
last = written[i]
if held_valid[i] != 0 and angles_deg[i][0] == last[0] and angles_deg[i][1] == last[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.

🔴 Critical · Design Architecture — Track explicit camera gaze writes

A direct set_gaze_angles call with unchanged values passes this equality check, so hybrid gaze restores the old world fixation instead of starting a new one. Track external setter writes explicitly.

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 b8c47ef. The camera now counts set_gaze_angles calls (FoveatedCamera.gaze_writes), and the gaze action notes the count after its own writes; a different count at the next hybrid step drops the held fixation, so any direct write starts a new one, including one that repeats the angles. The value comparison and its buffer are gone. A new test goes through GazeAction and the camera's setter: it sets the gaze to the angles it holds, turns the head, and checks the retina stays where it was set.

radius_rad = field_radius_deg * wp.float32(DEG_TO_RAD)
pan = targets[i, 0] - joint_pos[i, joints[0]]
tilt = targets[i, 1] - joint_pos[i, joints[1]]
pending[i] = wp.vec2f(signs[1] * tilt, signs[0] * pan) / radius_rad

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 — Compose queued head rotations

Joint-angle differences are not camera-frame gaze differences when the head is tilted. The teacher can correct an already queued turn. Compute pending gaze from composed current and target head orientations.

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 b8c47ef, exactly rather than by composing a difference: in physical gaze the teacher composes the camera-frame direction to the point with the measured head, which gives the head angles that face it, and labels the step from the commanded head angles to those. A new test, through GazeAction, tilts the head 20° up with a 5° pan already commanded and checks that the commanded head plus the label faces the point, by quaternion composition.

state[i] = wp.vec4f(current[0], current[1], rate[0], rate[1])


PHYSICAL, HYBRID, DUAL = 1, 2, 3

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 — Move constants before functions

The mode constants sit between module functions, contrary to the prescribed file order. Move them beside RAD_TO_DEG.

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.

Moved beside RAD_TO_DEG in b8c47ef.



@wp.func
def gaze_direction(g: wp.vec2f, field_radius_deg: wp.float32) -> wp.vec3f:

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 · Scope Complexity — Reuse the gaze geometry

These direction and angle equations duplicate teach's equations in the same module. Have teach call the shared functions and delete its copies to keep the conventions in one implementation.

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 b8c47ef: teach uses gaze_of and gaze_direction, which now sit above it.

# world. A gaze set on the camera since then starts a new fixation instead.
soft = gaze_of(wp.quat_rotate_inv(mounts[i], held[i]), field_radius_deg)
soft = within(soft + clamp_unit(wp.vec2f(actions[i, 0], actions[i, 1])) * step_size, gaze_limit)
# The head steps from where it is toward the fixation, at most head_step per coordinate.

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 — Delete the clamp narration

The comment only describes the following per-coordinate clamp; it adds no constraint or rationale. Delete it.

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 in b8c47ef.


@configclass
class SceneCfg(InteractiveSceneCfg):
ground = TerrainImporterCfg(prim_path="/World/ground", terrain_type="plane")

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 unused ground construction

This pose-only case asserts joint, gaze, and camera orientation, not ground rendering. Remove the terrain declaration and its scene-building cost.

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 in b8c47ef; the case still passes.


# -- Gaze modes that turn a rig ----------------------------------------------------------------------------------------

FIELD_RADIUS = 45.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.

🟡 Warning · Style Consistency — Group new test declarations

The added constants and RigStep helper follow test functions, with RADIUS_RAD after the class. Move constants and helpers before tests to follow the prescribed file order.

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 b8c47ef: the rig constants, RigStep and the new rig_term helper sit with the other helpers before the tests.

pan_target = math.radians(STEP * FIELD_RADIUS)
torch.testing.assert_close(rig.targets[0, 0], torch.tensor(pan_target), atol=1e-5, rtol=0)
# A gaze set on the camera between steps starts a new fixation instead of being aimed back at the old one.
rig.angles[0] = torch.tensor([2.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.

🟡 Warning · Test Quality — Exercise the claimed camera setter

This case claims a direct set_gaze_angles call starts a fixation but writes the kernel buffer instead; a setter regression would pass. Exercise the setter at the camera boundary.

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 b8c47ef: the new hybrid test calls the camera's setter through a stand-in camera that counts writes as the real one does.

retina = angles_to_direction(torch.tensor([0.0, 30.0]))
c, s = math.cos(math.radians(20.0)), math.sin(math.radians(20.0))
x, y, z = retina.tolist()
composed = direction_to_angles(torch.tensor([x, c * y - s * z, s * y + c * z])) / FIELD_RADIUS

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 — Use an independent composition oracle

The expected value repeats the production tilt rotation and angle conversion, so a shared geometry error can pass. Use hand-established angles or independent quaternion composition.

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 b8c47ef: the expected gaze now comes from composing the head and retina quaternions with isaaclab.utils.math.

pending = torch.zeros(1, 2)
with torch_stream("cpu"):
wp.launch(
pending_head_turn_kernel,

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 — Test pending turn through its owner

This invokes the kernel while the teacher test supplies pending values through a lambda; both pass if GazeAction.pending_head_turn stops producing them. Exercise that method with measured joints and targets.

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 b8c47ef: the pending-turn kernel is replaced by GazeAction.head_and_target, and the physical teacher test builds the term's rig through _init_rig, reads head_and_target, and labels through gaze_teacher_labels.

Comment on lines +279 to +283
last = written[i]
if held_valid[i] != 0 and angles_deg[i][0] == last[0] and angles_deg[i][1] == last[1]:
# The head turned since the last step: aim the software gaze back at the fixation it holds in the
# world. A gaze set on the camera since then starts a new fixation instead.
soft = gaze_of(wp.quat_rotate_inv(mounts[i], held[i]), field_radius_deg)

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.

P2 Repeated gaze commands get ignored

Hybrid gaze can discard an explicit set_gaze_angles call when it repeats the angles written by the previous step. After the retina pans 4.5° and the head moves 1°, setting the retina to 4.5° again should start a new fixation. Instead, this check replaces it with 3.5° to preserve the old fixation. Track explicit gaze writes separately from their values so repeated commands also take effect.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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 b8c47ef. The camera now counts set_gaze_angles calls (FoveatedCamera.gaze_writes), and the gaze action notes the count after its own writes; a different count at the next hybrid step drops the held fixation, so any direct write starts a new one, including one that repeats the angles. The value comparison and its buffer are gone. A new test goes through GazeAction and the camera's setter: it sets the gaze to the angles it holds, turns the head, and checks the retina stays where it was set.

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 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 24, 2026
@nblauch

nblauch commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@kellyguo11 @matthewtrepte this is ready for review. Greptile has no open findings, and both rounds from the Isaac Lab review bot are addressed in e3d1056 and b8c47ef, with replies on each thread. One bot point is left for you to weigh: it would put mode and rig after the existing GazeActionCfg fields to keep positional construction working; I kept them beside asset_name, since configs are built with keywords. I'll rebase the stacked stereo PR, #9183, once this one settles.

…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.
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

nblauch commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review only the three commits added since 0d2f7da: cd4f34e (Let the gaze teacher aim at world points), 8150e98 (Track gaze mounts on Isaac RTX) and f6bd99b (Read the camera's pose in the gaze teacher without capturing an image). The earlier commits are unchanged.

nblauch added a commit to nblauch/IsaacLab that referenced this pull request Nov 24, 2026
Binocular gaze now stacks on isaac-sim#9182 as well as isaac-sim#9181.
Both added to FoveatedCamera and the render cases at the same places;
the merge keeps both: gaze_writes beside _renders_switchable_rays,
mount_pos_w and update_mount beside supports_runtime_cmf_a, and the
hybrid and binocular cases before the runtime cmf_a case.
Three of this PR's changes fix bugs in the gaze teacher on main: it
rendered a frame for every label, a tracked mount's teacher aimed from
the mount of the step before, and a target naming the asset's only body
raised a TypeError. The first was listed under Changed and the other two
nowhere; all three are now under Fixed.
@nblauch
nblauch marked this pull request as draft December 1, 2026 22:18

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.

1 participant