Skip to content

fix: gait_terms 接触门控对 MuJoCo contact force 传感器取错力分量列 #1468

Description

@TATP-233

问题

src/unilab/tasks/locomotion/common/gait_terms.py:122_FootContactTerm 对 3-D force 传感器取第 2 列([0 if width == 1 else 2 ...])作为接触判据。但 microduck 的 left/right_foot_contact 是 MuJoCo <contact data="force"> 传感器,力向量在接触坐标系下第 0 列为法向力(实测站立时每脚 2.4–4.1 N、合计 ≈ 机重 8 N;第 1/2 列为小切向分量)。上游 microduck_rl(mjlab)用 found > 0 门控,无此问题。

证据(UniLab env、64 envs、mjwarp、seed 42 实测)

场景 第 0 列(法向,正确)接触率 第 2 列(现行)接触率 两约定一致率
站立(零 action) 98.3% 3.5% 5.2%
行走样动作 46.7% 20.9% 74.1%

站立时步态项把双脚 96.5% 的时间误判为腾空。

影响面

修复注意

  • src/unilab/tasks/locomotion/microduck/manager_terms.py 的 microduck 专用接触项已正确取第 0 列(threshold 0.1),可参照。
  • 需兼顾 width-1 found 与 width-3 force 两种传感器形态;检查其他在用机器人(如 go2)的力传感器坐标系约定(site-frame 力传感器 z 为法向时第 2 列才是对的),避免一刀切改列号引入回归。建议按传感器类型/坐标系显式声明列语义,而非硬编码列号。

来源:#1452 / #1464 根因分析(https://github.com/Motphys/UniLab/pull/1464#issuecomment-5526831969)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions