Skip to content

[FEATURE] Add avatar (kinematic) entity and refactor rigid entity.#2459

Closed
Kashu7100 wants to merge 39 commits intoGenesis-Embodied-AI:mainfrom
Kashu7100:feat-feat_avatar
Closed

[FEATURE] Add avatar (kinematic) entity and refactor rigid entity.#2459
Kashu7100 wants to merge 39 commits intoGenesis-Embodied-AI:mainfrom
Kashu7100:feat-feat_avatar

Conversation

@Kashu7100
Copy link
Collaborator

@Kashu7100 Kashu7100 commented Feb 24, 2026

Description

Adds a visualization-only KinematicEntity for displaying ghost/reference motions (e.g., mimic policy targets) without affecting physics or simulation speed. Closes #2062.

Continued from #2452

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Kashu7100 and others added 14 commits February 23, 2026 20:29
…ions

Add a lightweight AvatarEntity and AvatarSolver for displaying reference
motions (e.g., mimic policy targets) without affecting physics or simulation
speed. The avatar solver inherits from RigidSolver to reuse FK, kinematic
tree, and render transform infrastructure while disabling all collision,
constraint solving, and physics integration.

Key design: zero simulation overhead is guaranteed because the avatar solver's
substep methods are no-ops, and it doesn't break the _rigid_only fast path.
All geoms force contype=0/conaffinity=0 as a safety net.

Closes Genesis-Embodied-AI#2062

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AvatarSolver is visualization-only, so physics parameters (gravity,
collision, constraints, etc.) should not be exposed. Move all hardcoded
physics state into AvatarSolver.__init__ directly, skipping
RigidSolver.__init__, and reduce AvatarOptions to only `dt`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a full RigidOptions internally instead of SimpleNamespace to avoid
missing-field crashes. Override set_dofs_position to skip collider/
constraint_solver reset. Add examples/avatar/go2_avatar.py showing a
ghost Go2 with sinusoidal reference motion alongside a physics Go2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Defer FK to update_visual_states and use zerocopy fast path with cached
tensor views so set_dofs_position does only two indexed tensor writes
per call. Benchmark confirms zero simulation overhead when updating
avatar pose every step with CUDA tensors.

Results (2000 steps, headless, Go2):
  Without avatar:        ~700 steps/s
  With avatar (static):  ~700 steps/s  (+0%)
  With avatar (updating): ~730 steps/s (+0%)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on disabling

Fix correctness bug where zerocopy cache silently used stale dofs_idx on
subsequent calls with different indices. Remove AvatarVisGeom, trim
AvatarSolverState to position-only fields, simplify Avatar material API,
and add _GeomClass attribute to RigidLink to eliminate duplicated factory
methods in AvatarLink.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ions

Add a lightweight AvatarEntity and AvatarSolver for displaying reference
motions (e.g., mimic policy targets) without affecting physics or simulation
speed. The avatar solver inherits from RigidSolver to reuse FK, kinematic
tree, and render transform infrastructure while disabling all collision,
constraint solving, and physics integration.

Key design: zero simulation overhead is guaranteed because the avatar solver's
substep methods are no-ops, and it doesn't break the _rigid_only fast path.
All geoms force contype=0/conaffinity=0 as a safety net.

Closes Genesis-Embodied-AI#2062

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AvatarSolver is visualization-only, so physics parameters (gravity,
collision, constraints, etc.) should not be exposed. Move all hardcoded
physics state into AvatarSolver.__init__ directly, skipping
RigidSolver.__init__, and reduce AvatarOptions to only `dt`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a full RigidOptions internally instead of SimpleNamespace to avoid
missing-field crashes. Override set_dofs_position to skip collider/
constraint_solver reset. Add examples/avatar/go2_avatar.py showing a
ghost Go2 with sinusoidal reference motion alongside a physics Go2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Defer FK to update_visual_states and use zerocopy fast path with cached
tensor views so set_dofs_position does only two indexed tensor writes
per call. Benchmark confirms zero simulation overhead when updating
avatar pose every step with CUDA tensors.

Results (2000 steps, headless, Go2):
  Without avatar:        ~700 steps/s
  With avatar (static):  ~700 steps/s  (+0%)
  With avatar (updating): ~730 steps/s (+0%)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on disabling

Fix correctness bug where zerocopy cache silently used stale dofs_idx on
subsequent calls with different indices. Remove AvatarVisGeom, trim
AvatarSolverState to position-only fields, simplify Avatar material API,
and add _GeomClass attribute to RigidLink to eliminate duplicated factory
methods in AvatarLink.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AvatarSolver now inherits from Solver (base class) directly, with its own
build pipeline and kinematic init sequence. Avatar material inherits from
Material directly. Both classes are completely unrelated to their Rigid
counterparts, addressing reviewer feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
KinematicEntity was carrying ~80 physics methods that only work with
RigidSolver. Move them into RigidEntity so KinematicEntity is a minimal
kinematic+visualization base (morphology, FK, IK, DOF position get/set)
and RigidEntity holds all physics (forces, velocities, contacts, etc.).

Add no-op stubs in KinematicEntity for methods called by KinematicSolver:
process_input, process_input_grad, save_ckpt, load_ckpt, reset_grad,
zero_all_dofs_velocity.

Fix bug: _get_idx -> _get_global_idx in set_dofs_velocity_grad.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Kashu7100 Kashu7100 requested a review from duburcqa February 24, 2026 22:57
@duburcqa duburcqa changed the title [FETURE] add avatar (kinematic) entity and refactor rigid entity. [FETURE] Add avatar (kinematic) entity and refactor rigid entity. Feb 26, 2026
Kashu7100 and others added 3 commits February 27, 2026 23:15
The KinematicSolver and KinematicEntity classes are the primary
implementations. This removes the legacy "avatar" naming layer so
the codebase consistently uses "kinematic" throughout: materials,
options, solver state, simulator/scene attributes, visualizers,
examples, and tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The kinematic solver handles Mesh morphs correctly via the same
_load_mesh() path as RigidEntity, so the TODO noting it as buggy
was outdated. Add gs.materials.Kinematic() to the tested materials
and update the comp_key assertion to account for rigid-like entities
that produce tuple segmentation keys at link/geom level.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

⚠️ Abnormal Benchmark Result Detected ➡️ Report

@duburcqa duburcqa force-pushed the feat-feat_avatar branch 6 times, most recently from a18e4ff to e64869d Compare March 5, 2026 21:12
@duburcqa duburcqa closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add "ghost" entity.

3 participants