计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
solvers-contacts【效率与协作】Choose and configure Newton solvers and contact/collision workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
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 runs SolverXPBD by default and can try SemiImplicit, Featherstone, or MuJoCo when explicitly requested.import newton, newton.solvers.*, newton.CollisionPipeline, and newton.geometry.* when needed. Do not import from newton._src.ModelBuilder, state/control allocation, and ordinary simulation-loop construction to the modeling-simulation sub-skill.asset-import-export before returning here for solver/contact choices.sensors-visualization after this sub-skill has identified which contacts or solver outputs must be observed.CollisionPipeline for Newton-generated rigid/soft contacts, SDF contacts, hydroelastic contacts, contact matching, and deterministic contact ordering.SolverMuJoCo(..., use_mujoco_contacts=True) for MuJoCo-native contacts when MuJoCo semantics are desired and advanced Newton contact models are not needed.SolverMuJoCo(..., use_mujoco_contacts=False) plus CollisionPipeline when MuJoCo dynamics must consume Newton-generated contacts.SolverXPBD(model, iterations=5) plus CollisionPipeline(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.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.