control-physics-traffic
Use when an AlpaSim task concerns vehicle state, controller or MPC selection, ground-mesh physics, CATK traffic sessions, handover behavior, or backend/data requirements for these services.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- control-physics-traffic
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use when an AlpaSim task concerns vehicle state, controller or MPC selection, ground-mesh physics, CATK traffic sessions, handover behavior, or backend/data requirements for these services.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/backend-compatibility.md4.4 KB
- 参考文档references/controller-api.md6.2 KB
- 参考文档references/physics-and-traffic.md6.4 KB
- 参考文档references/troubleshooting.md6.2 KB
- 脚本scripts/check_backend.py2.6 KB
03 SKILL.md 正文
Control, physics, and traffic
Use this sub-skill for the three simulation components that close the motion loop:
- Controller: planar dynamic-bicycle vehicle state, linear/nonlinear MPC, trajectory tracking, and the controller gRPC session.
- Physics: Warp ground-mesh intersection that corrects vehicle/object poses; it is not a collision engine or a replacement for vehicle dynamics.
- Traffic: the CATK-backed traffic gRPC service, including session history, logged replay, handover, prediction batching, and failure statuses.
Do not use this sub-skill to compose a wizard deployment, choose a driver policy,
or edit protobufs. Route those to simulation-wizard, drivers-and-plugins, or
grpc-and-developer-tools, respectively. Use runtime-services for the
runtime's event loop and service orchestration, and evaluation-and-logs for
post-run logs and metrics.
Start with a capability and backend check
-
Identify the service being changed or queried. Record the simulation time unit, coordinate frame, scene identifier, and whether the request is replay or closed-loop inference.
-
Run the bundled, read-only probe before debugging imports or optional backends:
Read backend compatibility, then run the bundled backend checker before debugging imports or optional backends:
python scripts/check_backend.py python scripts/check_backend.py --usdz-folder /data/scenes \ --model-config /models/catk/config.yaml \ --checkpoint /models/catk/latest.ckpt \ --token-dir /models/tokensThe second form only inspects supplied paths; it never downloads or changes them. Treat warnings about CUDA, PyG extensions, USDZ, or model assets as capability limits, not as proof of a working CATK service.
-
For a controller-only CPU smoke test, use the package's focused tests or instantiate
LinearMPCwith an 8-element state and a time-stampedTrajectory. For a nonlinear smoke test, ensuredo_mpcand CasADi are importable before the firstcompute_controlcall. -
For physics, use a small valid PLY ground mesh and positive AABB dimensions.
PhysicsBackendconstructs Warp mesh data and launches CUDA kernels duringupdate_pose; a successful Python import is not a physics execution test. -
For CATK, verify the scene directory contains
.usdzfiles and that the model config, checkpoint, token directory, CUDA device, and matching PyG compiled extensions are all available. Never substitute a static traffic trajectory for a failed post-handover prediction.
See backend compatibility before installing optional packages and troubleshooting when a check fails.
Choose and use the controller
- Represent the current vehicle state in the documented order
[x, y, yaw, vx_cg, vy_cg, yaw_rate, steering, accel]. The position and yaw are for the rig origin in the temporary inertial frame;vx_cgandvy_cgare body-frame CG velocities. Do not silently treat rig-frame lateral speed as CG lateral speed. - Use linear MPC (
mpc_implementation: linear) as the normal fast choice. It linearizes the bicycle model about the current state and solves an OSQP QP. Use nonlinear MPC for aggressive maneuvers or tight turns when the slower do_mpc/CasADi/IPOPT solve is acceptable. This is a modeling trade-off, not a claim that nonlinear is always more stable. - Keep
n_horizonanddt_mpcconsistent with the trajectory sampling. The defaults are 20 steps and 0.1 seconds. Tracking cost begins atgains.idx_start_penalty(default 10), while actuator regularization applies to command changes. - In a service session, call
start_sessionbefore the first run, provide a non-empty planned trajectory, advance to a strictly laterfuture_time_us, and close the session exactly once. The first run lazily constructs the system and creates a CSV controller log. - Set
coerce_dynamic_statewhen current ground-truth dynamic state should replace the model's velocity, yaw rate, and acceleration before solving. The system converts rig-frame velocity to CG-frame velocity and preserves the integrated pose origin.
The exact dataclasses, solver bounds, frame conversion, service invariants, and standalone server flags are in controller API.
Apply ground constraints
-
Give the physics service a scene artifact glob ending in
.usdzand select a scene whose ground mesh is available. The command shape is:physics_server --artifact-glob '/data/artifacts/*.usdz' \ --host 0.0.0.0 --port 8080 --cache-size 16--use-ground-mesh,--visualize, and the cache size affect artifact/backend loading; visualization is optional and may require extra packages. -
For every pose, physics samples the bottom of the AABB, casts ±Z rays into the Warp mesh, fits a plane, and applies bounded translation/rotation corrections. It deliberately preserves predicted X/Y after correction and returns a status for each pose.
-
Handle
SUCCESSFUL_UPDATE,INSUFFICIENT_POINTS_FITPLANE,HIGH_TRANSLATION, andHIGH_ROTATIONas distinct observations. Repeated high corrections are usually a scene, AABB, timestamp, or upstream pose problem; do not hide them by retrying indefinitely.
Physics does not model collisions, full vehicle dynamics, or arbitrary lateral motion. See physics and traffic.
Run a CATK traffic session
-
Start the service only after its Hydra config resolves. A documented local shape is:
catk_trafficsim_server \ --config-path=/path/to/config-dir \ --config-name=server.yaml \ server.port=6200 \ catk.loader.usdz_folder=/data/scenesThe model paths and timing settings belong in the resolved config. The wizard normally writes this config for a container deployment; do not make a second deployment recipe here.
-
start_sessionrequires a session UUID, scene ID, at least one logged object trajectory includingEGO, and a positivehandover_time_us. The service builds a fixed history window (num_history_steps, default 16) sampled attime_step(default 0.1 s). -
At or before handover,
simulateresamples logged trajectories and returns replay. After handover, it resamples the latest history, fills the ego future from the request/update, runs CATK, and merges predicted agent trajectories. Requests are serialized per session but different sessions may reach the inference batcher concurrently. -
Respect the configured
prediction_steps(default 5). A request beyond the fixed prediction horizon isINVALID_ARGUMENT; missing usable map/model predictions after handover areFAILED_PRECONDITION. An unexpected model exception isINTERNAL. These statuses are actionable distinctions. -
Close sessions and retry only after fixing the reported scene, trajectory, horizon, map, model, or backend issue. There is no valid CPU/static fallback for CATK's required post-handover prediction path.
Use physics and traffic for the request sequence, config fields, batching semantics, and status mapping.
Verification and handoff
- Run parser/help checks for the bundled script and server commands without starting a daemon or downloading assets.
- Run controller system, linear-MPC, nonlinear-MPC, physics-utils, and traffic service/batching tests according to their backend markers. Keep CATK integration tests skipped unless CUDA, matching PyG extensions, USDZ scenes, and model weights are all present.
- Test the difficult cases in the review artifact: aggressive-turn controller
selection and a CATK
FAILED_PRECONDITIONafter handover. The expected answer must name the validation signal and must not invent a fallback. - If a service contract or protobuf message is the issue, hand off rather than duplicating generic message definitions. Record unresolved backend/data gaps explicitly in the verification report.
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).