Skip to content

refactor(deformable-infantry): merge refactored chassis implementation and add pitch HUD - #74

Closed
Yukikaze2233 wants to merge 3 commits into
mainfrom
feat/deformable-infantry
Closed

refactor(deformable-infantry): merge refactored chassis implementation and add pitch HUD#74
Yukikaze2233 wants to merge 3 commits into
mainfrom
feat/deformable-infantry

Conversation

@Yukikaze2233

@Yukikaze2233Yukikaze2233 commented May 10, 2026

Copy link
Copy Markdown
Member

Summary
Merge the refactored deformable chassis implementation from refactor/deformable-infantry and add a pitch angle HUD widget to the referee display.
Changes

  1. deformable_chassis.cpp — core refactor
  • Add IMU auto-calibration for pitch/roll offset at startup
  • Inline JointFeedbackSource, JointIndex, JointFeedbackFrame types into the DeformableChassis class, removing the standalone header dependency
  • Delete deformable_joint_layer.hpp (merged into chassis)
  • Remove dead code: unused SuspensionPhase enum, 8 suspension output interfaces that always published false/NaN
  • Rename variables back to original convention: active_suspension_Kp_ → pitch_kp_, active_suspension_Dp_ → pitch_kd_, etc.
  • Fix config parameter names to match existing YAML config files
  1. pitch_hud.hpp — new widget
  • Pitch angle HUD scale widget displayed on the right side of the referee screen
  • Dual indicators for gimbal pitch and chassis pitch
  • Configurable range, tick step, and center position
  1. deformable_infantry_ui.cpp — UI integration
  • Register /chassis/imu/pitch and /gimbal/pitch/angle inputs
  • Call pitch_hud_.update() in the update loop

变更概述

合并对可形变底盘(deformable chassis)的重构实现,新增裁判端俯仰角HUD小部件,并引入若干硬件/配置/构建脚本与机器人变体相关的改动(含 omni-b 变体、状态服务、CAN 传输节拍方案等)。

主要变更

核心控制器与接口

  • rmcs_core/src/controller/chassis/deformable_chassis.cpp

    • 重构 DeformableChassis:将关节/姿态辅助类型(JointFeedbackSource、JointIndex、JointFeedbackFrame、AttitudePidAxis 等)内联为类内嵌类型,移除旧的独立头文件。
    • 统一关节反馈采集:从 /chassis/*_joint/angle、/physical_angle、/physical_velocity、/torque 等接口组装 JointFeedbackFrame,异常/未就绪信号以 NaN 表示;遗留 encoder_angle 仅用于就绪验证/选择。
    • 更新循环职责:验证反馈、读入并净化反馈帧、管理底盘模式与速度控制、切换抬升目标、(可选)执行基于 IMU 的俯仰/横滚 PID 校正(启动时自动标定偏置,仅在对称目标请求期间采样)、为每关节生成受速度/加速度约束的目标轨迹并发布关节目标/物理目标/处理后的编码器角度。
    • 主动悬架简化:移除死代码(SuspensionPhase 枚举等),清理始终无效的悬架输出接口;PID 输出转化为每条腿的物理角度修正并夹紧到限值;悬架活跃时切换轨迹限制参数。
    • IMU 自动校准:在启动且关节目标对称时进行俯仰/横滚偏置标定。
    • 配置与变量名修正:将悬架 PID 等变量名恢复为原始命名(如 pitch_kp_、pitch_kd_),修正配置参数名以匹配现有 YAML。
  • rmcs_core/src/controller/chassis/deformable_joint_layer.hpp

    • 删除旧头文件:移除对外的关节相关公开类型与 JointTrajectoryPlanner 类定义(已移入 DeformableChassis 实现)。

UI(裁判端)

  • rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp(新增)
    • 新增 PitchHud 小部件:在裁判屏右侧绘制竖直俯仰刻度,支持配置中心、半高度、角度半幅、刻度步长等;提供对云台俯仰与底盘俯仰的双重指示器,输入无效时隐藏指示器。
  • rmcs_core/src/referee/app/ui/deformable_infantry_ui.cpp
    • 注册 ROS 输入 /chassis/imu/pitch 和 /gimbal/pitch/angle,构造时初始化 pitch_hud_,在 update() 循环中调用 pitch_hud_.update() 并传入有效或 NaN 的俯仰值。

硬件、变体与服务

  • 新增硬件插件与变体
    • rmcs_core/src/hardware/deformable-infantry-omni-b.cpp:新增 DeformableInfantryOmniB 硬件插件(omni-b 变体 — omni 底盘 + 转向云台,无独立 IMU 板),实现底板/顶板适配、TF 链、IMU/关节/轮反馈处理与按偶/奇周期交替发送的 CAN 帧调度(even: 0x200+0x142,odd: 0x141)。
    • 更新 plugins.xml:注册 rmcs_core::hardware::DeformableInfantryOmniB 插件类。
  • 其他硬件更新
    • rmcs_core/src/hardware/deformable-infantry-steering.cpp:为 DeformableInfantryV2 添加 /rmcs/service/robot_status Trigger 服务(返回格式化的电机原始角度状态),移除旧的“校准”订阅 plumbing,调整 BottomBoard 构造与初始化风格。
    • rmcs_core/src/hardware/deformable-infantry-omni.cpp:仅格式化/换行调整(超容器日志语句)。

配置与带来文件

  • rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni-b.yaml(新增)
    • 新增 omni-b 变体的 ROS 2 参数文件,包含组件映射、底盘/关节/IMU/主动悬架参数(含 IMU 校准时间窗)、各关节 ADRC/悬架参数及多部件配置。
  • rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni.yaml / deformable-infantry-steering.yaml
    • 调整 referee UI 组件映射为 DeformableInfantry 类名与 value_broadcaster 的转发列表(增加/移除若干转发话题)。

构建脚本与文档

  • .script/build-rmcs-cross(修改)
    • 新增 --link-default 标志:在 cross 构建后创建/更新指向 cross 构建输出的默认 build/install/log 软链接(包含检查与原子 ln -sfnT 操作)。
  • .script/complete/_build-rmcs-cross(修改)
    • 增加 shell completion 描述 --link-default。
  • docs/zh-cn/cross_build.md
    • 文档中补充 --link-default 的说明与示例用法,并对针对不同架构的命令片段做更明确说明。

附加提交摘要(提交信息提到的其它更改)

  • 引入 omni-b 变体与顶/底板协调实现。
  • 统一机器人状态/校准相关话题到 /rmcs/service/robot_status(以服务形式暴露)。
  • 采用偶/奇帧交替的 CAN 发送方案以分散总线负载(even/odd 分帧集)。
  • 对 BottomBoard/TopBoard 构造器与格式化做一致性调整。
  • 构建脚本增加便捷符号链接选项以便在不同构建变体间切换。
  • 包含 pitch HUD 小部件并在 referee UI 中集成显示。

影响范围与审查要点

  • 接口/API:将原有关节层(deformable_joint_layer.hpp)公开类型移入 DeformableChassis,公共类 DeformableChassis 仍被导出(PLUGINLIB_EXPORT_CLASS 保留)。需要关注外部模块对已删除头文件中类型的直接依赖。
  • 配置兼容性:修正了若干配置参数名以匹配现有 YAML;使用前请校验部署配置(尤其是主动悬架 PID 与 IMU 校准参数)。
  • 硬件/通信:omni-b 变体引入的两帧交替 CAN 方案与新服务端点可能影响底层板卡调度与上位监控,需在目标硬件上验证时序与帧完整性。
  • UI:新增 PitchHud 在 referee 界面增加可视化,需在裁判端分辨率与布局下验证显示位置与刻度配置。

Review Change Stack

…an up dead code
- Replace deformable_chassis.cpp with refactored version from
refactor/deformable-infantry branch
- Add IMU auto-calibration for pitch/roll offset
- Inline JointFeedbackSource/JointIndex/JointFeedbackFrame types,
removing dependency on deformable_joint_layer.hpp
- Rename suspension PID variables to original naming convention
(pitch_kp_, pitch_ki_, pitch_kd_, roll_kp_, roll_ki_, roll_kd_)
- Remove unused SuspensionPhase enum
- Remove 8 dead suspension output interfaces
(suspension_mode/suspension_torque always false/NaN)
- Fix config parameter names to match existing YAML config
- Delete deformable_joint_layer.hpp (merged into deformable_chassis.cpp)
- Add pitch_hud.hpp widget (pitch scale with gimbal/chassis indicators)
- Register /chassis/imu/pitch and /gimbal/pitch/angle inputs
- Call pitch_hud_.update() in deformable_infantry_ui update loop
@coderabbitai

coderabbitaiBot commented May 10, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8283c725-11ef-4f64-a15d-46297a1f7410

📥 Commits

Reviewing files that changed from the base of the PR and between e33df49 and 91449f5.

📒 Files selected for processing (11)
  • .script/build-rmcs-cross
  • .script/complete/_build-rmcs-cross
  • docs/zh-cn/cross_build.md
  • rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni-b.yaml
  • rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni.yaml
  • rmcs_ws/src/rmcs_bringup/config/deformable-infantry-steering.yaml
  • rmcs_ws/src/rmcs_core/plugins.xml
  • rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/deformable-infantry-omni-b.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/deformable-infantry-omni.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/deformable-infantry-steering.cpp

Walkthrough

此 PR 将 deformable 底盘控制器的关节轨迹与悬架/姿态逻辑内联到 DeformableChassis,删除旧 joint 层头;新增 PitchHud UI、build 脚本 --link-default 支持及文档/补全;添加 OmniB 硬件插件与 bringup 配置,并在 steering 中添加 robot_status 服务。

更改内容

底盘控制器整合重构

Layer / File(s)Summary
数据类型与公有接口
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp, rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_joint_layer.hpp
在 cpp 内新增嵌套数据类型:JointFeedbackSourceJointIndexJointFeedbackFrameAttitudePidAxis;同时删除原头文件中的等价公有声明。
构造函数与参数初始化
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
构造函数加载底盘速度/角度/悬架/PID 参数,初始化嵌套 PID 实例,注册输入/输出接口并验证 joint offset 配置以选择反馈源。
生命周期与输入处理
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
before_updating() 绑定缺失输入的安全默认值并验证反馈就绪;update() 读取开关、摇杆与键盘,处理模式切换、早期 reset、举升目标切换并发布角度输出。
联合反馈与目标初始化
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
统一读取并归一化关节反馈(motor/physical/velocity/torque;非法或未就绪为 NaN),并在首次激活时用反馈初始化轨迹/目标状态;遗留 encoder 仅用于就绪判定。
IMU 校准与主动悬架
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
仅在请求对称部署目标时累积 IMU 偏置;使用简化 pitch/roll PID 产出并转为 per-leg 物理角修正(夹紧到限幅),悬架激活会影响轨迹限值。
速度/角度控制与轨迹生成
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
将操纵杆+键盘映射到平移与角速度(含罗德里格旋转),按停止距离与速度/加速度限值积分更新每关节物理角并转换为电机角。
发布、错误与重置语义
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
发布每关节 motor 目标角、物理运动学、角误差及处理后编码器角;在无效输入或 reset 路径统一发布 NaN 并清除悬架/校准状态。

移除公有 joint 层头文件

Layer / File(s)Summary
删除头文件
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_joint_layer.hpp
删除整个头文件,移除 JointFeedbackSource/JointIndex/kJointNamesJointFeedbackFrameLegFeedbackJointIOJointTrajectoryPlanner 的公有声明与实现。

俯仰 HUD UI 新增功能

Layer / File(s)Summary
俯仰 HUD 组件定义
rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp
新增 header-only PitchHud 类及 PitchHud::Config,实现参数夹紧、initialize() 与 update() 接口。
坐标映射与渲染
rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp
实现 pitch→HUD Y 映射(夹紧到半跨度、像素映射、屏幕夹紧),初始化轴线与主/副刻度,渲染 gimbal(三线)与 chassis(四线)指示器。
HUD 与裁判 UI 集成
rmcs_ws/src/rmcs_core/src/referee/app/ui/deformable_infantry_ui.cpp
在构造中注册 /chassis/imu/pitch/gimbal/pitch/angle 输入,持有 PitchHud 成员,并在 update() 中按输入就绪/有限性调用 pitch_hud_.update(否则传 quiet_NaN)。

构建脚本、补全与文档

Layer / File(s)Summary
build-rmcs-cross 脚本
.script/build-rmcs-cross
新增 --link-default 选项解析与 link_default 标志,增加 check_default_linkable()link_default_base() 两个辅助函数,并在启用时创建/更新默认 build/install/log 的软链接。
补全与中文文档
.script/complete/_build-rmcs-cross, docs/zh-cn/cross_build.md
--link-default 增加 shell 补全条目;中文文档补充使用示例、等价 ln 命令及 native 恢复说明。

Bringup 配置与 forwarding 调整

Layer / File(s)Summary
新增 omni-b bringup
rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni-b.yaml
新增 executor 组件映射、deformable_infantry 设备零点、chassis/gimbal/joint 控制参数与四个关节控制器的 ADRC/悬架配置。
bringup 映射与 forwarding
rmcs_ws/src/rmcs_bringup/config/deformable-infantry-omni.yaml, ...-steering.yaml
将 referee UI executor 指向 DeformableInfantry;将 steering 的 value_broadcaster.forward_list 精简为仅转发 /gimbal/yaw/angle/gimbal/yaw/velocity

硬件插件与 Steering 变更

Layer / File(s)Summary
新硬件插件实现
rmcs_ws/src/rmcs_core/src/hardware/deformable-infantry-omni-b.cpp
新增 DeformableInfantryOmniB 节点/组件,含 BottomBoard/TopBoard 实现、TF/关节/IMU 输出、交替 CAN 命令调度以及 /rmcs/service/robot_status Trigger 服务。
插件注册与 Steering 调整
rmcs_ws/src/rmcs_core/plugins.xml, rmcs_ws/src/rmcs_core/src/hardware/deformable-infantry-steering.cpp
在 plugins.xml 注册 OmniB;在 steering 中添加 robot_status 服务回调、移除 calibrate 订阅、调整 BottomBoard 构造签名与成员初始化,并微调 supercap 日志格式化。

代码评审工作量估计

🎯 4 (复杂) | ⏱️ ~75 分钟

可能相关的 PR

建议审阅者

  • creeper5820
  • qzhhhi

诗歌

🐰 底盘合一心不慌,悬架轻拨稳如常,
HUD 指针俯仰扬,脚本连链省力忙。
插件上阵声声赞,代码合并兔子欢!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 3.85% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ Passed标题清晰准确地概括了本次 PR 的两个主要更改:重构可变形底盘实现和添加俯仰角 HUD。
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/deformable-infantry

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp (4)

38-45: ⚡ Quick win

JointFeedbackFrame::eso_z2 / eso_z3 字段从未被填充。

update_current_joint_feedback(line 522-561)只更新了 motor_anglesphysical_anglesphysical_velocitiesjoint_torques,而 eso_z2/eso_z3 始终保留构造时的零值(line 43-44)。如果当前实现暂时不需要 ESO 状态反馈,建议先把这两项从结构体中删掉,避免下游误把零当作真实数据;如计划接入,请补上对应的 register_input 与读取分支。

Also applies to: 419-425

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp` around
lines 38 - 45, The JointFeedbackFrame struct defines eso_z2 and eso_z3 but they
are never populated in update_current_joint_feedback, so either remove these
fields to avoid returning bogus zeros or implement proper input registration and
assignment: if removing, delete eso_z2 and eso_z3 from JointFeedbackFrame; if
keeping, add register_input calls for the ESO arrays and update the code in
update_current_joint_feedback to read and assign the ESO values into
JointFeedbackFrame::eso_z2 and ::eso_z3 (also ensure any other places that
consume JointFeedbackFrame are updated accordingly). Use the identifiers
JointFeedbackFrame, eso_z2, eso_z3, update_current_joint_feedback, and
register_input to locate the related code.

446-459: ⚡ Quick win

refresh_requested_joint_targets_from_deploy_state_ 中的 fill(min_angle_) 与悬挂控制重复。

suspension_requested_by_input_() 为真时,这里会把 requested_target_physical_angles_rad_ 全部填成 min_angle_,并把 current_target_physical_angles_rad_ 同步过去;但紧接着 update_active_suspension_(line 582-631)在同一条件下又会基于 base_target_angle = deg_to_rad(min_angle_) + PID 修正整体重写 current_target_physical_angles_rad_。第一次 fill 既不会被外部观察到(requested_target_physical_angles_rad_ 此后未再读),也掩盖了 deploy 状态原本的请求值,同时让两处的悬挂判断责任交叠,调试时容易误导。建议要么去掉这段悬挂分支,仅由 update_active_suspension_ 负责悬挂目标;要么显式记录"请求来自 suspension"以便后续观测。

Also applies to: 582-631

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp` around
lines 446 - 459, The code in
refresh_requested_joint_targets_from_deploy_state_() overwrites
requested_target_physical_angles_rad_ with deg_to_rad(min_angle_) when
suspension_requested_by_input_() is true, duplicating responsibility with
update_active_suspension_() and hiding the original deploy-requested targets;
remove that fill branch so refresh_requested_joint_targets_from_deploy_state_()
only copies deploy-state angles into requested_target_physical_angles_rad_ and
leaves suspension handling to update_active_suspension_(), or alternatively
replace the fill with setting a suspension_requested_flag_ (read by
update_active_suspension_()) without mutating
requested_target_physical_angles_rad_; touch the symbols
requested_target_physical_angles_rad_, current_target_physical_angles_rad_,
refresh_requested_joint_targets_from_deploy_state_(),
update_active_suspension_(), suspension_requested_by_input_(), and
min_angle_/base_target_angle accordingly.

374-382: ⚡ Quick win

joint_angle_deg 是未被引用的代码,建议删除。

在整个仓库中搜索结果显示,该方法仅在定义处出现一次,没有任何调用或引用。这疑似是从旧实现迁移后的遗留代码。直接删除可以减少代码复杂性和后续维护成本。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp` around
lines 374 - 382, Remove the unused member function joint_angle_deg from
deformable_chassis.cpp: delete the entire definition (the overload taking const
InputInterface<double>& joint_angle, const InputInterface<double>&
joint_encoder_angle, double joint_offset, double legacy_fixed_compensation) and
any related forward declarations; ensure there are no remaining references to
joint_angle_deg, then rebuild/tests to confirm no breakages. References to
symbols in the removed code include JointFeedbackSource::kMotorAngle and
wrap_deg—use these to locate the exact function to remove.

846-869: ⚡ Quick win

删除未使用的 publish_current_joint_target_angles 方法以消除代码重复

publish_current_joint_target_angles(第 846-869 行)与 initialize_joint_target_states_from_feedback(第 803-819 行)的逻辑完全相同:都读取电机角度、计算物理角度,然后初始化相同的状态变量并设置 joint_target_active_ = true。唯一的区别是前者从输入接口读取角度,后者接收作为参数。

在整个代码库中没有找到对 publish_current_joint_target_angles 的任何调用,而 initialize_joint_target_states_from_feedbackrun_joint_intent_pipeline_ 正确调用。建议删除 publish_current_joint_target_angles 以避免维护两份几乎相同的逻辑。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp` around
lines 846 - 869, The function publish_current_joint_target_angles duplicates
initialize_joint_target_states_from_feedback and is unused; remove the
publish_current_joint_target_angles definition (and any forward declaration) and
any tests or references to it, keeping
initialize_joint_target_states_from_feedback as the single source of truth used
by run_joint_intent_pipeline_. Ensure you only delete the
publish_current_joint_target_angles symbol (and related includes if any become
unused) and run a build to verify no remaining references.
rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp (1)

48-55: ⚡ Quick win

tick_capacity_ = 25 在常见配置下会被静默截断。

按默认 half_span_deg = 30tick_step_deg = 5 需要 13 个刻度,能放下;但 set_config 仅约束 tick_step_deg ≥ 1,因此当用户传入 tick_step_deg = 1(甚至 2)时,所需刻度数为 2 * 30 / 1 + 1 = 61std::clamp(..., 1, 25) 会直接截断到 25,HUD 仅覆盖配置范围的一小段且无任何告警。建议根据 half_span_deg / tick_step_deg 动态调整容量,或在 set_config 中按 tick_capacity_ 反向 clamp tick_step_deg 下限以保证刻度始终覆盖完整 span。

♻️ 一种最小改动方案:限制 tick_step_deg 以适配容量
 void set_config(Config config) {
config.tick_step_deg = std::max(config.tick_step_deg, 1.0);
config.half_span_deg = std::max(config.half_span_deg, config.tick_step_deg);
config.half_height_px = std::max<uint16_t>(config.half_height_px, 40);
+ // 保证刻度数不超过容量;否则按需放大 step 以覆盖完整 span+ const double min_step_for_capacity =+ 2.0 * config.half_span_deg / static_cast<double>(tick_capacity_ - 1);+ config.tick_step_deg = std::max(config.tick_step_deg, min_step_for_capacity);
config_ = config;
initialize_();
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp` around lines
48 - 55, The hard-coded tick_capacity_ (25) allows silent truncation in
initialize_() when config_.tick_step_deg is small; fix by ensuring the
configured tick_step_deg cannot demand more ticks than tick_capacity_—in
set_config enforce a lower bound like tick_step_deg >=
ceil(2*config_.half_span_deg/(tick_capacity_-1)) (use size/ceil math to
compute), then recompute tick_count_ in initialize_() as you do now;
alternatively, make tick_capacity_ dynamic (grow to required size before
computing tick_count_). Update set_config and reference tick_capacity_,
initialize_(), tick_count_, config_.half_span_deg and config_.tick_step_deg
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp`:
- Around line 989-1017: The publish_nan_joint_targets() function currently
resets all joint target outputs but omits clearing *processed_encoder_angle_;
update publish_nan_joint_targets() (after the existing
angle/velocity/acceleration and error assignments) to set
*processed_encoder_angle_ = nan_ so that processed_encoder_angle_ is NaN when
feedback is unavailable (matching reset_all_controls() behavior) and prevents
downstream consumers from seeing stale encoder values.
---
Nitpick comments:
In `@rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp`:
- Around line 38-45: The JointFeedbackFrame struct defines eso_z2 and eso_z3 but
they are never populated in update_current_joint_feedback, so either remove
these fields to avoid returning bogus zeros or implement proper input
registration and assignment: if removing, delete eso_z2 and eso_z3 from
JointFeedbackFrame; if keeping, add register_input calls for the ESO arrays and
update the code in update_current_joint_feedback to read and assign the ESO
values into JointFeedbackFrame::eso_z2 and ::eso_z3 (also ensure any other
places that consume JointFeedbackFrame are updated accordingly). Use the
identifiers JointFeedbackFrame, eso_z2, eso_z3, update_current_joint_feedback,
and register_input to locate the related code.
- Around line 446-459: The code in
refresh_requested_joint_targets_from_deploy_state_() overwrites
requested_target_physical_angles_rad_ with deg_to_rad(min_angle_) when
suspension_requested_by_input_() is true, duplicating responsibility with
update_active_suspension_() and hiding the original deploy-requested targets;
remove that fill branch so refresh_requested_joint_targets_from_deploy_state_()
only copies deploy-state angles into requested_target_physical_angles_rad_ and
leaves suspension handling to update_active_suspension_(), or alternatively
replace the fill with setting a suspension_requested_flag_ (read by
update_active_suspension_()) without mutating
requested_target_physical_angles_rad_; touch the symbols
requested_target_physical_angles_rad_, current_target_physical_angles_rad_,
refresh_requested_joint_targets_from_deploy_state_(),
update_active_suspension_(), suspension_requested_by_input_(), and
min_angle_/base_target_angle accordingly.
- Around line 374-382: Remove the unused member function joint_angle_deg from
deformable_chassis.cpp: delete the entire definition (the overload taking const
InputInterface<double>& joint_angle, const InputInterface<double>&
joint_encoder_angle, double joint_offset, double legacy_fixed_compensation) and
any related forward declarations; ensure there are no remaining references to
joint_angle_deg, then rebuild/tests to confirm no breakages. References to
symbols in the removed code include JointFeedbackSource::kMotorAngle and
wrap_deg—use these to locate the exact function to remove.
- Around line 846-869: The function publish_current_joint_target_angles
duplicates initialize_joint_target_states_from_feedback and is unused; remove
the publish_current_joint_target_angles definition (and any forward declaration)
and any tests or references to it, keeping
initialize_joint_target_states_from_feedback as the single source of truth used
by run_joint_intent_pipeline_. Ensure you only delete the
publish_current_joint_target_angles symbol (and related includes if any become
unused) and run a build to verify no remaining references.
In `@rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp`:
- Around line 48-55: The hard-coded tick_capacity_ (25) allows silent truncation
in initialize_() when config_.tick_step_deg is small; fix by ensuring the
configured tick_step_deg cannot demand more ticks than tick_capacity_—in
set_config enforce a lower bound like tick_step_deg >=
ceil(2*config_.half_span_deg/(tick_capacity_-1)) (use size/ceil math to
compute), then recompute tick_count_ in initialize_() as you do now;
alternatively, make tick_capacity_ dynamic (grow to required size before
computing tick_count_). Update set_config and reference tick_capacity_,
initialize_(), tick_count_, config_.half_span_deg and config_.tick_step_deg
accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f58e52bf-ab93-4fef-812f-a8e70dfed31c

📥 Commits

Reviewing files that changed from the base of the PR and between 7578778 and e33df49.

📒 Files selected for processing (4)
  • rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_chassis.cpp
  • rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_joint_layer.hpp
  • rmcs_ws/src/rmcs_core/src/referee/app/ui/deformable_infantry_ui.cpp
  • rmcs_ws/src/rmcs_core/src/referee/app/ui/widget/pitch_hud.hpp
💤 Files with no reviewable changes (1)
  • rmcs_ws/src/rmcs_core/src/controller/chassis/deformable_joint_layer.hpp

@github-project-automationgithub-project-automationBot moved this from Todo to Done in RMCSMay 10, 2026
… chassis
- Add deformable-infantry-omni-b: omni chassis + steering gimbal, no separate IMU board
- Replace per-chassis calibrate topics with unified /rmcs/service/robot_status
- Adopt two-frame alternating CAN transmission (even: 0x200+0x142, odd: 0x141)
- Align BottomBoard constructor formatting across omni/omni-b/steering
- Add --link-default to build-rmcs-cross for convenience symlinks
- Add pitch HUD widget to referee UI
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant

@Yukikaze2233