Skip to content

Conversation

@pascal-roth
Copy link
Collaborator

@pascal-roth pascal-roth commented Jan 25, 2026

Description

Adds test that the camera pose is updated when update_latest_camera_pose is set to True.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@pascal-roth pascal-roth marked this pull request as draft January 25, 2026 22:15
@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Jan 25, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 25, 2026

Greptile Overview

Greptile Summary

This PR adds a test case test_camera_update_pose_with_moving_xform that validates camera pose updates when update_latest_camera_pose=True. The test creates an ANYmal-C robot with a camera attached to its base link with a (0.5, 0.0, 0.2) offset, then verifies the camera's world position correctly tracks the robot's base position over 20 simulation steps.

Key aspects tested:

  • Camera spawned under /World/Robot/base/Camera with position offset in parent's local frame
  • Verification that camera.data.pos_w updates correctly when parent transform changes
  • Multi-step tracking validation (not just single-frame check)
  • Error tolerance of 2% for maximum error and 1.5% for mean error

The test addresses the camera pose staleness issue that was fixed in commit cbf51ab (#4374), which added Fabric backend support to XformPrimView and resolved the staling camera pose reading problem reported in #3177.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it only adds a test case without modifying production code
  • Test implementation is sound and correctly validates the camera pose update feature. The test properly creates a robot-camera hierarchy, calculates expected positions using quaternion rotation of the local offset, and verifies tracking over multiple timesteps. Previous review concerns about duplicate offset assignment and incorrect base position retrieval appear to have been addressed
  • No files require special attention

Important Files Changed

Filename Overview
source/isaaclab/test/sensors/test_camera.py Adds test for camera pose tracking with update_latest_camera_pose=True; verifies camera follows robot motion over 20 timesteps

Sequence Diagram

sequenceDiagram
    participant Test as Test Function
    participant Sim as Simulation Context
    participant Robot as Articulation (ANYmal-C)
    participant Camera as Camera Sensor
    participant Physics as Physics Engine

    Test->>Sim: setup_sim_camera fixture
    Test->>Robot: Create Articulation(ANYMAL_C_CFG)
    Test->>Camera: Create Camera with offset (0.5, 0.0, 0.2)
    Note over Camera: prim_path=/World/Robot/base/Camera<br/>update_latest_camera_pose=True<br/>convention="world"
    
    Test->>Sim: sim.reset()
    Test->>Robot: robot.reset()
    Test->>Camera: camera.reset()
    
    Test->>Sim: sim.step()
    Test->>Robot: robot.update(dt)
    Test->>Camera: camera.update(dt)
    Note over Camera: Calls _update_poses()<br/>reads world pose via XformPrimView
    
    Test->>Camera: Get initial_camera_pos
    Test->>Robot: Get initial_base_pos & initial_base_quat
    Test->>Test: Calculate expected_pos = base_pos + quat_apply(base_quat, offset)
    Test->>Test: Assert initial position matches (rtol=0.02)
    
    loop 20 simulation steps
        Test->>Sim: sim.step()
        Test->>Robot: robot.update(dt)
        Physics->>Robot: Apply gravity, update physics state
        Test->>Camera: camera.update(dt)
        Note over Camera: update_latest_camera_pose=True<br/>triggers _update_poses()
        Camera->>Camera: _view.get_world_poses()
        Camera->>Camera: Update data.pos_w
        Test->>Camera: Get current_camera_pos
        Test->>Robot: Get current_base_pos & current_base_quat
        Test->>Test: Calculate expected_pos = base_pos + quat_apply(base_quat, offset)
        Test->>Test: Compute and store error
    end
    
    Test->>Test: Verify max_error < 0.02
    Test->>Test: Verify mean_error < 0.015
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@pascal-roth pascal-roth changed the title [IN PROGRESS] Fixes camera position update Adds test for camera pose update checking Jan 26, 2026
@pascal-roth pascal-roth marked this pull request as ready for review January 26, 2026 08:11
@pascal-roth pascal-roth self-assigned this Jan 26, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant