solvers-contacts
Choose and configure Newton solvers and contact/collision workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- solvers-contacts
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Choose and configure Newton solvers and contact/collision workflows.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/contact-and-tuning.md3.5 KB
- 参考文档references/solver-selection.md4.5 KB
- 参考文档references/troubleshooting.md3.1 KB
- 脚本scripts/compare_solver_step.py3.3 KB
03 SKILL.md 正文
Newton solvers and contacts
Use this sub-skill when a task requires choosing a Newton solver, wiring a solver step loop, deciding whether to use CollisionPipeline or MuJoCo-native contacts, enabling SDF/hydroelastic contact generation, or tuning solver/contact behavior.
Read order
references/solver-selection.md— solver feature/coordinate matrix, public constructor signatures, solver-step contracts, and solver routing rules.references/contact-and-tuning.md— contact pipeline setup, MuJoCo contact routes, contact material fields, SDF/hydroelastic prerequisites, and tuning workflow.references/troubleshooting.md— symptom-driven fixes for coordinate mismatches, missing optional dependencies, unsupported joints/geometries, contact capacity, SDF/hydroelastic setup, and determinism.scripts/compare_solver_step.py— safe smoke helper for a tiny scene. It runsSolverXPBDby default and can try SemiImplicit, Featherstone, or MuJoCo when explicitly requested.
Operating boundaries
- Use public APIs only:
import newton,newton.solvers.*,newton.CollisionPipeline, andnewton.geometry.*when needed. Do not import fromnewton._src. - Route basic
ModelBuilder, state/control allocation, and ordinary simulation-loop construction to themodeling-simulationsub-skill. - Route URDF/MJCF/USD parsing and mesh preprocessing/import questions to
asset-import-exportbefore returning here for solver/contact choices. - Route viewer, contact visualization, and sensor diagnostics to
sensors-visualizationafter this sub-skill has identified which contacts or solver outputs must be observed. - Treat MuJoCo, Kamino, VBD, coupled solvers, SDF, hydroelastic, and GPU-deterministic behavior as capability-specific choices that need explicit environment and feature checks.
Default decision path
- Identify the model type: free rigid bodies, generalized-coordinate robot, maximal-coordinate mechanism, particles/cloth/soft bodies, MPM material, or coupled multi-physics.
- Identify the contact source:
- Use
CollisionPipelinefor Newton-generated rigid/soft contacts, SDF contacts, hydroelastic contacts, contact matching, and deterministic contact ordering. - Use
SolverMuJoCo(..., use_mujoco_contacts=True)for MuJoCo-native contacts when MuJoCo semantics are desired and advanced Newton contact models are not needed. - Use
SolverMuJoCo(..., use_mujoco_contacts=False)plusCollisionPipelinewhen MuJoCo dynamics must consume Newton-generated contacts.
- Use
- Start conservative:
SolverXPBD(model, iterations=5)plusCollisionPipeline(model)is the safe default for tiny public Newton scenes unless the task specifically needs generalized coordinates, MuJoCo semantics, cloth/soft/MPM, Kamino loops, or coupled solvers. - Before tuning contact gains, verify geometry, collision groups/world indices, forward kinematics freshness, contact counts, buffer capacities, and the selected solver's feature support.
Minimal public loop pattern
import warp as wp
import newton
builder = newton.ModelBuilder(gravity=(0.0, 0.0, -9.81))
builder.add_ground_plane()
body = builder.add_body(xform=wp.transform(p=(0.0, 0.0, 0.55), q=wp.quat_identity()))
builder.add_shape_sphere(body, radius=0.5)
model = builder.finalize(device="cpu")
solver = newton.solvers.SolverXPBD(model, iterations=5)
state_in = model.state()
state_out = model.state()
control = model.control()
pipeline = newton.CollisionPipeline(model)
contacts = pipeline.contacts()
dt = 1.0 / 60.0 / 4
for _ in range(4):
state_in.clear_forces()
pipeline.collide(state_in, contacts)
solver.step(state_in, state_out, control, contacts, dt)
state_in, state_out = state_out, state_in
For a runnable version with diagnostics and fallback behavior, use scripts/compare_solver_step.py.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).