Skip to content

Feat/a2arm pos force - #1050

Closed
lemon-star608 wants to merge 194 commits into
mainfrom
feat/a2arm-pos-force
Closed

Feat/a2arm pos force#1050
lemon-star608 wants to merge 194 commits into
mainfrom
feat/a2arm-pos-force

Conversation

@lemon-star608

Copy link
Copy Markdown
Collaborator

功能概述

  • 新增 A2Arm 位置-力控制 locomotion 环境。
  • 集成 A2 四足底盘、P7v3 机械臂和 UMI 夹爪的 MuJoCo 仿真模型。
  • 新增 CSE-PPO 算法、Runner、Estimator、Storage 和训练入口。
  • 新增 CSE-PPO 与 A2Arm 位置-力任务的 Hydra 配置。
  • 新增 A2Arm 位置-力控制的交互式 MuJoCo 播放脚本。
  • 扩展 backend 接口,支持底座线速度状态写入。
  • 新增模型结构、FK 初始姿态、观测布局、力矩限制、环境步进和 backend 状态写入等 contract 测试。

主要改动

A2Arm 位置-力控制环境

  • 新增 A2ArmPosForce 环境及对应配置。
  • 新增 A2Arm、P7v3 和 UMI 夹爪的 MJCF 模型与网格资源。
  • 支持位置-力指令生成、力跟踪、末端轨迹控制和域随机化。
  • 通过现有 locomotion registry 注册环境。

CSE-PPO 训练流程

  • 新增 CSE-PPO actor-critic、estimator、storage、algorithm 和 runner。
  • 新增 scripts/train_cse_ppo.py 训练入口。
  • 新增 conf/ppo_cse/ 下的算法和任务配置。
  • 在 RSL-RL 训练封装中传递环境步进时间参数。

MuJoCo 交互控制

  • 新增 scripts/play_a2arm_pos_force_interactive.py
  • 支持 A2Arm 任务的交互式指令、轨迹、力控制和可视化。
  • 新增 MuJoCo backend 底座线速度写入能力。

验证

  • make test-all
  • A2Arm fast contract tests:6 个通过
  • A2Arm slow runtime tests:3 个通过

TATP-233 and others added 15 commits August 26, 2026 21:05
…umba

perf(managers): continue reducing update_state cost (#1316)
Multi-rank off-policy collectors pin their MuJoCo BatchEnvPool workers to
a per-rank CPU block via EnvCfg.cpu_ids, but the collector's host-side
compute did not follow: Numba's parallel kernels sized their pool from the
host CPU count and drifted across rank boundaries, and the OpenBLAS pool
spawned at import kept the host-wide mask.

NpEnv.__init__ now applies apply_env_cpu_runtime(cfg.cpu_ids) on the cold
path: the process is confined to the block (existing threads pinned
individually via /proc/self/task, later threads — including Numba's
lazily-launched pool — inherit the mask) and Numba's pool is sized to
len(cpu_ids) unless NUMBA_NUM_THREADS is set explicitly. cpu_ids=None keeps
the single-rank path bit-identical. Backend-agnostic: any env declaring
cpu_ids (e.g. motrix once it grows affinity support) gets the same
confinement.
…lock

perf(env): confine DP collector host compute to the per-rank CPU block
perf(mjwarp): reduce g1 motion tracking reset latency
… probes (#1328)

Diagnostic probes for the SAC/MuJoCo single-GPU collector CPU
under-utilization report: pool thread-count scaling on the G1 scene, and
per-phase wall/CPU attribution of a full task env step. New files only;
no behavior change.
…hread-sizing

benchmark(env): add MuJoCo pool thread-scaling and env-step phase-CPU probes (#1328)
os.sched_setaffinity/sched_getaffinity are Linux-only, so mypy on darwin
rejected the direct attribute access (attr-defined) and the unit tests'
monkeypatch.setattr/delattr failed because the attributes do not exist.

Resolve the affinity symbols via getattr at call time (identical runtime
semantics, still monkeypatchable) and pass raising=False to the test
monkeypatch seams so they work whether or not the host exposes them.
fix(base): cpu_runtime 在非 Linux 主机上的类型检查与测试修复
Reward displays (tensorboard reward/mean and the terminal logger) lagged
badly on off-policy and APPO runs:

- collectors sent metrics only every num_envs * 10 env steps, so the
  reported reward changed just once per ~10 learner iterations;
- runners then averaged the last 100 (off-policy) or 50 (APPO) reports,
  each already a rolling 100-episode mean, delaying the visible curve by
  ~1000 iterations.

Report metrics every collector cycle, keep the runner-side window at the
last 10 reports, and bound the per-worker episode reward/length buffers
with deque(maxlen=100) instead of lists that grew for the whole run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ManagerBasedRlEnv.reset() replaced state.info["log"] with the reset-only
extras (Episode_Reward/*), wiping the fresh per-step reward/* entries that
_update_state_in_read_phase() had just computed for the current transition.
On any step where at least one env resets — with thousands of envs, nearly
every step — collectors therefore saw no reward/* keys at all, so the
per-term reward components in tensorboard and the terminal logger stayed
frozen at one stale value for thousands of iterations (observed as long
flat staircases on reward/motion_* etc.).

Merge instead of replace on the autoreset path: the pre-reset per-step
entries stay, reset extras layer on top. Standalone (non-autoreset) resets
are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fix(logging): make collector reward reporting timely
…rsubscription (#1328)

Single-GPU (cpu_ids=None) BatchEnvPool sizing now uses the CPUs actually
usable by this process (len(os.sched_getaffinity(0)), falling back to
os.cpu_count() where unavailable) instead of 2*cpu_count(). Measured on
this machine (sac + g1_motion_tracking + mujoco, num_envs=4096, 2000 iters,
steady-state second-half median): 86,162 -> 96,262 steps/s (+11.7%),
collector env_step 47.6ms -> 41.9ms. Explicit cpu_ids still fixes
nthread = len(cpu_ids).
Base automatically changed from dev/issue-1042-manager-based-api to main September 4, 2026 17:33
@TATP-233

TATP-233 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

后续移动到unilab-gallery或者unitree-rl-unilab或者单独仓库

@TATP-233 TATP-233 closed this Sep 4, 2026
@TATP-233
TATP-233 deleted the feat/a2arm-pos-force branch September 4, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants