microduck_rl
microduck_rl 源码分析:从一次 rollout 读到优化器
用确定性夹具追踪注册、重置、动作、奖励和导出。

你将学会
- Map environment, simulator, and runner
- Run a reproducible simulation
- Identify sim-to-real gates
开始前需要
- Basic Git and command-line usage
- Comfort reading a project README
You can explain the project, run its documented first step, and decide what to verify before adopting it.
先看结论
- A single rollout exposes most contracts.
- Seed and device behavior need tests.
- Simulation fixtures are safer than hardware regressions.
Read the repository as a graph
固定 checkout 后追踪 reset、observation、action clip、physics step、reward、done、buffer 和 optimizer,并记录张量形状与设备。
Use the pinned source evidence, record versions and assumptions, and ask a qualified reviewer to validate the result before adopting it.
Trace a rollout
Follow reset, observation construction, action clipping, physics stepping, reward accumulation, termination, buffer insertion, and optimizer update. Record tensor shapes, devices, and episode counters.
Safe contributions
Add fixtures for reward terms, reset determinism, action bounds, seed parity, checkpoint metadata, and simulator failures without requiring a physical robot.
Use the pinned source evidence, record versions and assumptions, and ask a qualified reviewer to validate the result before adopting it.
如何选择
| 比较维度 | 方案 A | 方案 B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
实施步骤
- 1
Pin source and dependencies.
- 2
Trace reset-to-update symbols.
- 3
Inspect limits, rewards, and logs.
- 4
Add deterministic fixture tests.
可复制示例
fixture -> env registry -> reset/obs
-> policy/action clip -> mjlab step
-> reward/done -> buffer -> optimizer/export常见问题
Can I inspect the code without GPU?
Usually yes with static analysis and tiny CPU fixtures; validate GPU-specific paths separately.
What is a useful first issue?
A deterministic test for reset, reward, action bounds, or checkpoint metadata.
资料来源
- microduck_rl repository来源核查 2026-08-31