Add targeted checkerboard material utility - #3216
Conversation
Add a tiled-camera utility that applies the checkerboard texture only to explicit shape indices and deprecate the previous all-shapes helper. Update the tiled camera example to checker only the ground plane so imported robot visual materials remain visible, and cover the API migration in tests.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new ChangesShape-selective checkerboard material
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@newton/_src/sensors/warp_raytrace/utils.py`:
- Around line 865-882: The function does not validate the `resolution` and
`checker_size` parameters before using them in the checkerboard generation logic
at line 881. Add validation checks immediately after the shape_indices
validation to ensure both `resolution` and `checker_size` are positive integers
(greater than 0). If either parameter is invalid, raise a clear ValueError that
explains the constraint. Place these checks before the checkerboard calculation
that uses `np.arange(resolution) // checker_size` to prevent ZeroDivisionError
and invalid texture generation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 041566a6-0a71-4835-88eb-e918cb99108e
📒 Files selected for processing (6)
CHANGELOG.mdnewton/_src/sensors/sensor_tiled_camera.pynewton/_src/sensors/warp_raytrace/utils.pynewton/examples/sensors/example_sensor_tiled_camera.pynewton/tests/test_sensor_tiled_camera.pynewton/tests/test_sensor_tiled_camera_heightfield.py
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Resolve tiled camera sensor conflicts after main removed legacy compatibility helpers. Keep the new selective checkerboard utility and update the PR on top of current main.
Summary
SensorTiledCamera.utils.assign_checkerboard_material(shape_indices=...)so checkerboard material can be applied to explicit shapes only.assign_checkerboard_material_to_all_shapes()as of Newton 1.4 and route legacy all-shapes behavior through the new API.sensor_tiled_cameraso only the ground plane receives the checkerboard texture, preserving the Franka robot's imported visual materials.Root Cause
The tiled camera example used the old all-shapes checkerboard helper as a stand-in for ViewerGL's checker floor. That helper also textured the robot, so parts of the Franka rendered with checkerboard albedo instead of their imported visual colors.
Links: #3213
Validation
uv run python docs\generate_api.pyuv run -m newton.examples sensor_tiled_camera --viewer null --test --quiet --num-frames 1$env:WARP_CACHE_PATH = Join-Path $env:TEMP 'warp-newton-checkerboard-pr-cache'; uv run --extra dev -m unittest newton.tests.test_sensor_tiled_camera newton.tests.test_sensor_tiled_camera_heightfielduvx ruff check CHANGELOG.md newton\_src\sensors\warp_raytrace\utils.py newton\_src\sensors\sensor_tiled_camera.py newton\examples\sensors\example_sensor_tiled_camera.py newton\tests\test_sensor_tiled_camera.py newton\tests\test_sensor_tiled_camera_heightfield.pyuvx ruff format --check newton\_src\sensors\warp_raytrace\utils.py newton\_src\sensors\sensor_tiled_camera.py newton\examples\sensors\example_sensor_tiled_camera.py newton\tests\test_sensor_tiled_camera.py newton\tests\test_sensor_tiled_camera_heightfield.pyuvx pre-commit run -aSummary by CodeRabbit
New Features
Deprecations