fix(newton): support newton 1.5/1.6 (removed attributes, target layout, tiled camera) - #37
Open
geng-haoran wants to merge 1 commit into
Open
fix(newton): support newton 1.5/1.6 (removed attributes, target layout, tiled camera)#37geng-haoran wants to merge 1 commit into
geng-haoran wants to merge 1 commit into
Conversation
…t, tiled camera) The pinned newton (git main, 1.6.0.dev0) could not build a scene: Model.joint_target_pos was removed in 1.5, the tiled-camera API changed in 1.4, Model.num_worlds was renamed in 1.6, and position targets moved to the joint_q layout so every env after a free joint received its targets three joints off. Version-guarded shims and index tables fix all four; CameraState.depth is emitted as (N, H, W). Verified: 82 newton tests pass and the four newton get_started cases render. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MetaSim's
pyprojectinstallsnewton @ git+https://github.com/newton-physics/newton.git(currently 1.6.0.dev0), butNewtonHandlerwas written against newton < 1.2 and could no longer construct a scene:Model.joint_target_poswas removed in 1.5, the tiled-camera sensor API changed in 1.4,Model.num_worldswas renamed in 1.6, and — the one that bites silently — position targets moved to thejoint_qlayout. Four changes, all version-guarded so older newton keeps its current path:_newton_compat.py):Model/Controljoint_target_pos/joint_target_vel→joint_target_q/joint_target_qd(read/write properties over the 1.5RemovedAttributedescriptors);Model.num_worlds→world_count.joint_target_qout likejoint_q(a free joint takes 7 slots, not 6) and publishesjoint_target_q_start. The handler indexed position targets by dof (joint_qd_start) everywhere, so in any scene with a free-floating object every env after env 0 received its targets three joints off (env 1'spanda_joint1was driven topanda_joint4's target). All six write/read sites now usejoint_target_q_startwhen the model has it and fall back to the dof layout otherwise; velocity targets and gains stay dof-indexed as before.SensorTiledCamera(model, default_render_config=RenderConfig(...)), rays/outputs/light fromsensor.utils, rendering throughsensor.updateafterbvh_refit_shapes; textures that the sensor cannot load (RGB where RGBA is expected) fall back to untextured rendering with a warning instead of disabling cameras.CameraState.depthis(N, H, W); the handler produced(N, H, W, 1)andCameraState.__post_init__rejected it.Verification (RTX 5090, newton 1.6.0.dev0, warp 1.17)
pytest metasim/test/ -k newton: before — construction failed outright; with 1+3+4 only — 76 passed, 6 failed (test_set_dof_targets_per_env,test_parallel_envs_actions,test_parallel_envs_simulate_consistency× {2, 4} envs, all "env 1 didn't move towards target"); with 2 — 82 passed, 6 skipped, 6 xfailed, 0 failed.--sim newton(the four scripts that declare newton): 4/4 pass (0_static_scene, 1_control_robot, 2_add_new_robot, 3_parallel_envs); rendered frames/videos in the session report.metasim/test/test_newton_compat_general.py(new,general): the shims against a syntheticnewtonmodule with the 1.5 descriptors and the pre-1.5 attributes; 2 passed.mjlab.velocity_flat_go1_v2on Newton with 2 envs (for RoboVerse #817) runs on this branch.Not verified
No newton < 1.5 install was available here, so the legacy branches are exercised only by the synthetic-module test; they are the unchanged code paths behind the version guards.
🤖 Generated with Claude Code
https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw