[Feature]: Per-env domain randomization of geom contact solver params
Hi team — first, thanks for Genesis, it's been great to work with for large-batch RL.
I'm using Genesis for sim-to-real on a contact-rich in-hand manipulation task (a dexterous hand reorienting a cube), and ran into one gap in the per-environment domain-randomization surface that I wanted to raise — and offer to help with.
What already works nicely (per-env DR)
Genesis exposes several per-environment randomization knobs, which is exactly what sim2real needs:
- State-level, always per-env (
RigidSolverState, shape(_B, ...)):friction_ratio,mass_shift,i_pos_shift→ per-env friction / mass / COM. - Model-level, opt-in via flags:
batch_dofs_info/batch_links_info/batch_joints_info→ per-env kp/kv, armature, frictionloss, damping, link inertia, and jointsol_params.
These cover most of the usual DR ranges and work well.
What seems to be missing
Per-env geom contact compliance (sol_params = [timeconst, dampratio, dmin, dmax, width, mid, power], i.e. the MuJoCo solref/solimp analog) does not appear to be randomizable per environment:
- In
RigidSolver.set_sol_params(...), the geom branch hardcodesbatched = False(onlyjoints_idx/eqs_idxcan be batched), so passing a(n_envs, ...)tensor withenvs_idxfor geoms raises "Expecting at most 1D tensor". - There is no
batch_geoms_infooption (onlybatch_dofs_info/batch_links_info/batch_joints_info). RigidSolverStatehasfriction_ratioper geom/env, but no analogous per-env field forsol_params— geomsol_paramslives only in the sharedgeoms_info.
So contact stiffness/damping can only be set globally (shared across the whole batch), whereas friction can already vary per env.
(Version: genesis==1.0.0.)
Why it matters
For contact-rich manipulation, randomizing contact compliance per env (alongside friction) is one of the more important levers for closing the sim2real gap — it's a standard part of DR recipes elsewhere (e.g. MuJoCo solref/solimp randomization). Per-env friction alone covers tangential grip but not normal-direction stiffness/restitution, so the policy can overfit to the simulator's exact contact response.
Possible directions
A couple of options that would mirror existing patterns:
- Add a per-env
sol_params_ratio(or full per-envsol_params) field ingeoms_state, mirroring howfriction_ratioworks, and have the contact constraint kernel read the per-env value — then expose it via aset_geoms_sol_params/envs_idx-aware setter. - Or add a
batch_geoms_infooption (parallel tobatch_dofs_info) that makesgeoms_info.sol_paramsper-env.
Is per-env geom sol_params something you'd consider supporting, or is there an existing path I've missed? Happy to help test, and I'd be glad to contribute a PR (option 1 looks like the smaller change since friction_ratio is a good template) if that'd be welcome.
Thanks!
Source: Genesis-Embodied-AI/genesis-world