modeling-simulation
Build, step, and debug core Newton simulation models, states, controls, contacts, worlds, shapes, joints, and public loop patterns.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- modeling-simulation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build, step, and debug core Newton simulation models, states, controls, contacts, worlds, shapes, joints, and public loop patterns.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md5.1 KB
- 参考文档references/troubleshooting.md2.7 KB
- 参考文档references/workflows.md3.8 KB
- 脚本scripts/build_minimal_scene.py2.5 KB
03 SKILL.md 正文
Newton modeling and simulation
Use this sub-skill when the task is to create or debug a Newton model, state, control, shape, joint, articulation, world replication, collision-pipeline allocation, or a minimal simulation loop with public APIs.
Route here for
newton.ModelBuilder,newton.Model,newton.State,newton.Control, andnewton.Contactsusage.- Choosing
add_body()versusadd_link()and connecting links with joints/articulations. - Adding primitive, mesh, heightfield, SDF, or site geometry through public builder methods.
- Static, kinematic, and dynamic body setup.
- Forward/inverse kinematics helper calls such as
newton.eval_fk()andnewton.eval_ik(). - Allocating
CollisionPipeline, contacts, state buffers, and control buffers. - Replicating worlds with
ModelBuilder.replicate()and reasoning aboutworld_count. - CPU/CUDA device selection through Warp for small smoke checks.
- Fixing no-contact or stale-state issues in a basic loop.
Route elsewhere
- Solver choice, MuJoCo/Kamino/VBD/MPM/coupled solver behavior, or contact tuning: use
../solvers-contacts/SKILL.md. - URDF, MJCF, USD, mesh file import, schema resolvers, or asset conversion: use
../asset-import-export/SKILL.md. - Actuators, controller objects, IK objective workflows, and
ArticulationView: use../robotics-control/SKILL.md. - Sensors, viewers, example CLI, recording, and visualization: use
../sensors-visualization/SKILL.md.
Read order
references/api-reference.mdfor verified public constructors and core method signatures.references/workflows.mdfor minimal loops, world replication, body/joint patterns, and validation order.references/troubleshooting.mdfor import/device, stale FK, target-layout, contact-capacity, and validation failures.scripts/build_minimal_scene.pywhen you need a safe, runnable public-API smoke test.
Core loop checklist
- Set global compatibility switches, such as
newton.use_coord_layout_targets = True, before constructing aModelBuilderwhen joint position targets are involved. - Build or replicate the model with public
ModelBuildermethods. - Finalize the builder into a
Model, optionally passing a Warp device string. - Allocate two
Statebuffers, oneControl, oneCollisionPipeline, and aContactsbuffer from the pipeline. - Call
newton.eval_fk(model, model.joint_q, model.joint_qd, state)before maximal-coordinate solvers or collision checks when generalized coordinates define the initial pose. - Per substep: clear forces, collide, solver-step, then swap state buffers.
- Validate counts and array shapes before tuning physics.
Minimal safe smoke
From this sub-skill directory, run:
python scripts/build_minimal_scene.py --device cpu --steps 3
Use --device cuda:0 only after the root scripts/check_newton_env.py --require-cuda succeeds. The script prints body/shape/joint counts and the final body_q shape; it does not download assets or open a viewer.
Operating rules
- Use public imports only:
import newton,import newton.geometry, andimport warp as wp. - Do not teach future users to import from
newton._src; private modules are implementation evidence, not runtime API. - Prefer small checks on CPU first, then repeat on CUDA only when the task requires acceleration.
- Treat
ModelBuilder.finalize()validation warnings as actionable evidence; do not hide them by using broadskip_validation_*flags unless the task explicitly asks for advanced recovery. - Keep model construction and solver tuning separate: prove the scene has the expected bodies, joints, shapes, worlds, and contacts before changing solver parameters.
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).