Skip to content

Enhance wheel-leg functionality and improve RL model validation - #10

Merged
ZGZ713912 merged 32 commits into
mainfrom
dev/wheel-leg-refactor
Nov 12, 2026
Merged

ZGZ713912 merged 32 commits into
mainfrom
dev/wheel-leg-refactor

Conversation

@ZGZ713912

@ZGZ713912 ZGZ713912 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

概述

本 PR 将 rmcs_rl 从独立策略服务进程 + 自定义 ROS 消息重构为进程内推理的 RMCS 插件组件,同时统一轮腿观测/动作的 YAML 契约,补齐模型交付收据、遥测与文档。

规模:32 个提交,103 个文件,+4065 / −6461。

背景

旧方案通过 policy_server 独立进程与 msg/Action.msg、Observation.msg、PolicyStatus.msg 与主控通信。跨进程带来时延与同步开销,消息接口与观测布局各自演进容易漂移,且模型与观测契约缺少启动期校验。

主要改动

1. 推理层内置(src/policy/)

  • onnx_runtime.*:ORT 会话封装与 IO 校验(单入单出、float32、rank 1–3)
  • policy_model.*:启动期契约校验(模型 sha、观测契约、版本、metadata、零观测有限性)
  • policy_worker.*:工作线程 + 双缓冲;失败闭锁、reset() 恢复、队列计数

2. 接线层重写(src/rl_bridge/)

  • config.*:结构化 YAML(observations.* / actions.*)解析与校验
  • observation_builder.hpp:按 order 组装,select → source_clip → scale → offset → clip
  • observation_frame_gate/history/timeline:帧序号门控、历史堆叠、节流
  • policy_actions.hpp / policy_status.hpp:动作通道与状态通道拆分
  • rl_bridge.cpp:会话、使能、复位、失效传播

3. 遥测(src/visualization/)

  • WheelLegMirrorComponent 发布 joint_states、imu_body、rl_projected_gravity、rl_angular_velocity、diagnostics,供 Isaac Sim 镜像

4. 模型交付

  • 新增 model_receipts/:每个部署模型配一份 .deployment.json 收据
  • prepare_wheel_leg_model.py(盖章/校验)、export_wheel_leg_training_pair.py(离线导出候选)

5. 工具与文档

  • wheel_leg_policy_host(本地仿真)、wheel_leg_latency_bench(时延基准)、install_rl_deps.sh(ORT 依赖)、wheel_leg_telemetry.py(Foxglove 接收/录制)
  • 新增 docs/wheel_leg_live_mirror.md、docs/troubleshooting.md;README 改为中文并补“快速开始”

破坏性变更

  1. 删除 3 个消息定义(msg/Action.msg、Observation.msg、PolicyStatus.msg)——外部消费者会编译失败。已确认本工作区内无引用。
  2. 删除独立推理进程(src/policy_server.cpp、policy_server_launcher.cpp、launch/policy_server.launch.py)。
  3. 头文件迁移:include/rmcs_rl/** 全部删除,改到 src/ 下,include 路径变化。
  4. YAML 格式变更:观测从 key=value 字符串改为结构化映射,旧配置不再兼容。
  5. 旧模型工具链删除:stamp_*、rl_layout.py、check_policy_contract.py、install_model_tools.sh,由 prepare_wheel_leg_model.py 取代。

验证

  • CI:colcon build --packages-up-to rmcs_rl(容器 qzhhhi/rmcs-develop)
  • 本轮未执行本地 build-rmcs、未做实车验证
  • 未覆盖:长时间稳定性、模型热切换、失效恢复的现场表现

建议重点审查

  1. src/rl_bridge.cpp 的会话/复位/失效语义,与旧 policy_server 的行为差异
  2. observation_builder.hpp 的组装顺序与缩放,是否与各车型 YAML 对齐
  3. 测试覆盖下降:删除 15 个测试文件(test/*.cpp、fixtures、layout 脚本),新增仅 1 个 46 行 Python 测试
  4. models/ 下 18 个模型文件有增删,确认部署实际指向的模型仍在

Preserve the verified preview graph while stamping paired-107 and YAML layout metadata. Authenticate source/contract hashes, record the deployment receipt, and reject model/YAML policy-rate mismatches.

Add positive inference and negative clock, mechanical, winding and history contract checks. Preserve the preview's unqualified hardware status.
Drop explanatory and cross-component comments in rl_bridge, the policy runtime and the wheel-leg mirror. Keep data-layout and protocol facts.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 103 files, which is 3 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0b2a1940-a301-4e3c-b673-706e29548a75
Commits

Reviewing files that changed from the base of the PR and between 0af92de and 7410aea.

Files selected for processing: 103

  • .clang-format
  • .github/workflows/ci.yml
  • .gitignore
  • CMakeLists.txt
  • README.md
  • docs/troubleshooting.md
  • docs/wheel_leg_live_mirror.md
  • include/rmcs_rl/parameters.hpp
  • include/rmcs_rl/rl_bridge/action_channel.hpp
  • include/rmcs_rl/rl_bridge/action_feedback_history.hpp
  • include/rmcs_rl/rl_bridge/config.hpp
  • include/rmcs_rl/rl_bridge/interface_binding.hpp
  • include/rmcs_rl/rl_bridge/joint_config.hpp
  • include/rmcs_rl/rl_bridge/observation.hpp
  • include/rmcs_rl/rl_bridge/observation_history.hpp
  • include/rmcs_rl/rl_bridge/observation_timeline.hpp
  • include/rmcs_rl/rl_bridge/term_parser.hpp
  • include/rmcs_rl/rl_bridge/types.hpp
  • include/rmcs_rl/rl_bridge/utility.hpp
  • include/rmcs_rl/rl_layout.hpp
  • launch/policy_server.launch.py
  • model_receipts/wheel_leg/flat_directional200_1346_preview_20261020.deployment.json
  • model_receipts/wheel_leg/prone_motion_v4_100hz.deployment.json
  • model_receipts/wheel_leg/wheelbipe_v202_12500_50hz.deployment.json
  • model_receipts/wheel_leg/wheelbipe_v202_16001_50hz.deployment.json
  • model_receipts/wheel_leg/wheelbipe_v202_50hz.deployment.json
  • model_receipts/wheel_leg/wheelbipe_v202_8500_50hz.deployment.json
  • models/deformable/deformable_sps_V0.onnx
  • models/deformable/deformable_sps_V1.onnx
  • models/deformable/deformable_v2_transformer.onnx
  • models/deformable/deformable_v3_transformer.onnx
  • models/wheel_leg/flat.onnx
  • models/wheel_leg/flat_directional200_1346_preview_20261020.onnx
  • models/wheel_leg/policy.onnx
  • models/wheel_leg/prone_motion_v4_100hz.onnx
  • models/wheel_leg/recovery_candidate.onnx
  • models/wheel_leg/self_wake_V1.0.onnx
  • models/wheel_leg/wheel_leg_v1_MLP.onnx
  • models/wheel_leg/wheel_leg_v2.onnx
  • models/wheel_leg/wheel_leg_v3.onnx
  • models/wheel_leg/wheel_leg_v3_test.onnx
  • models/wheel_leg/wheelbipe_v202_12500_50hz.onnx
  • models/wheel_leg/wheelbipe_v202_16001_50hz.onnx
  • models/wheel_leg/wheelbipe_v202_50hz.onnx
  • models/wheel_leg/wheelbipe_v202_8500_50hz.onnx
  • msg/Action.msg
  • msg/Observation.msg
  • msg/PolicyStatus.msg
  • package.xml
  • plugins.xml
  • src/parameters.cpp
  • src/policy/onnx_runtime.cpp
  • src/policy/onnx_runtime.hpp
  • src/policy/policy_config.hpp
  • src/policy/policy_model.cpp
  • src/policy/policy_model.hpp
  • src/policy/policy_worker.cpp
  • src/policy/policy_worker.hpp
  • src/policy_server.cpp
  • src/policy_server_launcher.cpp
  • src/rl_bridge.cpp
  • src/rl_bridge/action_channel.cpp
  • src/rl_bridge/config.cpp
  • src/rl_bridge/config.hpp
  • src/rl_bridge/interface_binding.cpp
  • src/rl_bridge/joint_config.cpp
  • src/rl_bridge/observation.cpp
  • src/rl_bridge/observation_builder.hpp
  • src/rl_bridge/observation_frame_gate.hpp
  • src/rl_bridge/observation_history.cpp
  • src/rl_bridge/observation_history.hpp
  • src/rl_bridge/observation_timeline.hpp
  • src/rl_bridge/policy_actions.hpp
  • src/rl_bridge/policy_status.hpp
  • src/rl_bridge/term_parser.cpp
  • src/rl_bridge/utility.cpp
  • src/visualization/wheel_leg_mirror.cpp
  • test/data/extra_input_identity.onnx
  • test/data/normalized_identity.onnx
  • test/data/seq_history_mismatch.onnx
  • test/data/seq_identity.onnx
  • test/data/seq_layout_dynamic.onnx
  • test/data/seq_layout_mismatch.onnx
  • test/data/seq_layout_only.onnx
  • test/data/typed_extra_input_identity.onnx
  • test/gen_extra_input_fixture.py
  • test/gen_seq_fixtures.py
  • test/gen_synthetic_policy.py
  • test/gen_typed_extra_input_fixture.py
  • test/runtime_test.cpp
  • test/test_layout.py
  • test/test_layout_contract.sh
  • tests/test_wheel_leg_export_receipt.py
  • tool/check_policy_contract.py
  • tool/export_wheel_leg_training_pair.py
  • tool/install_model_tools.sh
  • tool/prepare_wheel_leg_model.py
  • tool/rl_layout.py
  • tool/simulation/wheel_leg_latency_bench.cpp
  • tool/simulation/wheel_leg_policy_host.cpp
  • tool/stamp_layout_metadata.py
  • tool/stamp_model.sh
  • tool/visualization/wheel_leg_telemetry.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Action performed

Review skipped: 103 files exceed the limit of 100.

@ZGZ713912

Copy link
Copy Markdown
Member Author

@coderabbitai summary

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Action performed

Review skipped: 103 files exceed the limit of 100.

@ZGZ713912 ZGZ713912 self-assigned this Nov 12, 2026
@ZGZ713912
ZGZ713912 merged commit 26d29ce into main Nov 12, 2026
2 checks passed
@ZGZ713912
ZGZ713912 deleted the dev/wheel-leg-refactor branch November 12, 2026 14:43
ZGZ713912 added a commit that referenced this pull request Nov 16, 2026
* chore(rl): remove stamping tools and synthetic tests

* feat(rl): integrate wheel-leg deployment and startup model validation

* refactor(rl): run policy inference in RMCS worker thread

* fix(rl): remove install rule for deleted launch directory

* feat(wheel_leg): add leg target winding functionality

* feat(wheel_leg): enhance wheel leg model configuration

* 11

* feat(rl_controller): enhance recovery and observation handling

* feat(wheel_leg): enhance wheel-leg YAML interface and config

* fix(wheel_leg): preserve deployed recovery timing and push-off

* chore: keep only the recovery vehicle profile

* chore: drop the wheel-leg YAML integration test

* chore: point docs and tools at the renamed vehicle profile

* refactor(rl): keep threaded policy bridge separate from chassis control

* chore: add new ONNX model files for wheel leg

* feat(rl): validate and package the 200 Hz directional wheel-leg actor

Preserve the verified preview graph while stamping paired-107 and YAML layout metadata. Authenticate source/contract hashes, record the deployment receipt, and reject model/YAML policy-rate mismatches.

Add positive inference and negative clock, mechanical, winding and history contract checks. Preserve the preview's unqualified hardware status.

* test(observation_frame): add unit tests for gate behavior

* feat(policy): add observation version and normalization checks

* feat(policy): package prone and WheelBipe deployment snapshots

* refactor: give RL bridge explicit worker and action output ownership

* feat(policy): export evaluated WheelBipe 8500 snapshot independently

* feat(policy): add WheelBipe deployment files

* feat(telemetry): add WheelLegMirrorComponent for ROS 2 integration

* chore: remove narrative comments from RL bridge sources

Drop explanatory and cross-component comments in rl_bridge, the policy runtime and the wheel-leg mirror. Keep data-layout and protocol facts.

* feat(simulation): add wheel_leg_policy_host for local testing

* refactor(telemetry): remove raw IMU data handling

* feat(rl_bridge): add structured configuration support

* fix(docs): update wheel-leg controller references

* refactor: remove unused test files and dependencies

* feat(latency): add wheel leg latency benchmark tool

* refactor: remove utility functions and improve structure

* feat(receipts): add model receipt generation support
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.

1 participant