Repository navigation
Add interactive body dragging with MjvPerturb forces and mocap support - #33
Closed
shawn-maybush wants to merge 3 commits into
Closed
shawn-maybush wants to merge 3 commits into
shawn-maybush wants to merge 3 commits into
Conversation
…d selective callback removal
… Viser private internals Normalize MjvPerturb.localmass by model.vis.map.stiffness so perturbation_stiffness stays in N/(m*kg) across models with custom map stiffness, apply active drag forces when single-stepping while paused, hide the perturbation force line when paused, and track live drag handle IDs in ViserMujocoScene instead of reading handle._impl.removed.
Author
|
I closed as PR #21 is more comprehensive and further along. |
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
Adds interactive 3D body clicking and dragging using Viser's
SceneNodeHandle.on_dragAPI (viser>=1.0.30), respecting the two-layer architecture betweenViserMujocoSceneandViewer:ViserMujocoScene(src/mjviser/scene.py):BodyDragEvent(exported frommjviser) andadd_body_drag_callback/on_body_drag/remove_body_drag_callback/remove_body_drag_callbacks._mesh_groups), fixed body geom handles (_fixed_geom_handles), and dynamic convex-hull handles (_hull_dynamic_handles), automatically re-binding when visual or hull handles are rebuilt.instance_indexvalues back to(env_idx, body_id, mocap_id)for both full-batch andshow_only_selectedslicing modes, and subtractsscene_offsetso callback coordinates are reported in MuJoCo world space.Viewer(src/mjviser/viewer.py):cmd/ctrl(pull & tumble) andcmd/ctrl+shift(rotate) drag callbacks backed by MuJoCo's nativeMjvPerturb,mjv_applyPerturbPose, andmjv_applyPerturbForcefor mass-scaled, velocity-damped spring perturbations and direct mocap / paused free-body manipulation.MjvPerturb.localmassbymodel.vis.map.stiffnesssoperturbation_stiffnessremains in<map stiffness=.../>./perturbation_force) while dragging dynamic bodies and adds a Perturbation folder under the Physics tab withStiffnessandTorque Scalesliders.Test Plan
uv run ruff format --check&uv run ruff checkuv run pyright(0 errors)uv run pytest(83 passed, including new unit tests intests/test_scene.pyandtests/test_viewer_drag.pycovering multi-env instance decoding, convex-hull handle dragging, selective callback removal, spring/torque perturbations, damping, custom<map stiffness=.../>, mocap manipulation, and paused single-stepping)