Skip to content

Add VT13 remote control and dual control arbitration - #93

Merged
creeper5820 merged 1 commit into
dev/robotsfrom
dev/VTM-link
Jul 19, 2026
Merged

Add VT13 remote control and dual control arbitration#93
creeper5820 merged 1 commit into
dev/robotsfrom
dev/VTM-link

Conversation

@floatpigeon

@floatpigeonfloatpigeon commented Jul 19, 2026

Copy link
Copy Markdown
Member

VT13图传链路遥控接入与双遥控器仲裁

PR 摘要

通过视频传输链路新增 VT13 遥控接入,并实现 DR16 与 VT13 两类遥控器的输入仲裁。

主要变更

  • 新增 VT13 数据帧解析、CRC 校验、状态维护及 500ms 超时失效机制。
  • 重构 DR16 状态管理,增加数据有效性、状态重置及旋钮开关访问接口。
  • 新增 RemoteControl,统一注册 DR16/VT13,并根据控制模式和设备有效性选择输入源。
  • 在多种机器人硬件组件中接入远控更新流程及设备注册。
  • 为 VT13 增加 UART0 接收、状态更新和缓冲区管理。
  • 调整 AutoAimUi 配置条目顺序,不改变其参数内容。

@coderabbitai

coderabbitaiBot commented Jul 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1641df4-b2c8-491d-94a9-1bf2e7740de8

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

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/VTM-link

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.

@floatpigeon
floatpigeon marked this pull request as draft July 19, 2026 07:41
@floatpigeon
floatpigeon removed the request for review from creeper5820July 19, 2026 07:42
@floatpigeon
floatpigeon marked this pull request as ready for review July 19, 2026 07:43

@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

🤖 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/hardware/device/dr16.hpp`:
- Around line 49-58: Resolve the cross-thread race in the DR16 status state by
making valid_ atomic and using acquire/release semantics for its writes and
reads. Update store_status(), refresh_validity(), update_status(), and valid()
consistently, and synchronize last_remote_control_received_at_ as well—either
protect both fields with the same mutex or use an atomic time
representation—while preserving the existing validity and
RemoteControl::update() behavior.
🪄 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: a5d3fd9e-6cdd-4796-afe2-b4955972d969

📥 Commits

Reviewing files that changed from the base of the PR and between d49071c and 91fd222.

📒 Files selected for processing (10)
  • rmcs_ws/src/rmcs_bringup/config/steering-hero-little-six-friction.yaml
  • 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/device/dr16.hpp
  • rmcs_ws/src/rmcs_core/src/hardware/device/remote_control.hpp
  • rmcs_ws/src/rmcs_core/src/hardware/device/vt13.hpp
  • rmcs_ws/src/rmcs_core/src/hardware/flight.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/omni_infantry.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/sentry.cpp
  • rmcs_ws/src/rmcs_core/src/hardware/steering-hero-little-six-friction.cpp

Comment on lines +49 to +58

last_remote_control_received_at_ = Clock::now();
valid_ = true;
}

void update_status() {
const auto now = Clock::now();
refresh_validity(now);
if (!valid_)
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

valid_ / last_remote_control_received_at_ 存在跨线程数据竞争。

store_status()(第 49-51 行)在 UART 回调线程中以普通(非原子)方式写入 last_remote_control_received_at_valid_;而 update_status()/refresh_validity()(第 55-58、192-198 行)以及 valid()(第 155 行)在组件主更新线程读取/写入这两个字段,全程没有任何同步(不像 data_part1_/data_part2_/data_part3_ 已经是 std::atomic)。这是本 PR 新引入的未同步跨线程访问,属于未定义行为的数据竞争。

对比 vt13.hpp:其 valid_/last_remote_control_received_at_ 只在 update_status()(主线程)内部写入,store_status() 只写入环形缓冲区,因此没有这个问题——这恰好印证了 dr16.hpp 这里的不对称是个真实缺陷。

该竞争会直接影响 RemoteControl::update() 在全部 6 个硬件文件(deformable-infantry-omni-b.cpp、deformable-infantry-omni.cpp、flight.cpp、omni_infantry.cpp、sentry.cpp、steering-hero-little-six-friction.cpp)中基于 dr16_->valid() 的仲裁判断,因此在此处统一说明,不在各硬件文件重复。

🔒 建议修复:将 valid_ 改为原子变量并使用 acquire/release 语义
- Vector mouse_velocity_ = Vector::zero();- double mouse_wheel_ = 0.0;+ Vector mouse_velocity_ = Vector::zero();+ double mouse_wheel_ = 0.0;
@@
- double rotary_knob_ = 0.0;- rmcs_msgs::Switch rotary_knob_switch_ = rmcs_msgs::Switch::UNKNOWN;- TimePoint last_remote_control_received_at_ = TimePoint::min();- bool valid_ = false;+ double rotary_knob_ = 0.0;+ rmcs_msgs::Switch rotary_knob_switch_ = rmcs_msgs::Switch::UNKNOWN;+ TimePoint last_remote_control_received_at_ = TimePoint::min();+ std::atomic<bool> valid_ = false;
- last_remote_control_received_at_ = Clock::now();- valid_ = true;+ last_remote_control_received_at_ = Clock::now();+ valid_.store(true, std::memory_order::release);
 void update_status() {
const auto now = Clock::now();
refresh_validity(now);
- if (!valid_)+ if (!valid_.load(std::memory_order::acquire))
return;
 void refresh_validity(const TimePoint now) {
- if (!valid_ || now - last_remote_control_received_at_ <= kFreshTimeout)+ if (!valid_.load(std::memory_order::acquire)+ || now - last_remote_control_received_at_ <= kFreshTimeout)
return;
reset_remote_control_state();
- valid_ = false;+ valid_.store(false, std::memory_order::relaxed);
}
- bool valid() const noexcept { return valid_; }+ bool valid() const noexcept { return valid_.load(std::memory_order::acquire); }

Also applies to: 192-198, 279-280, 155-156

🤖 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/hardware/device/dr16.hpp` around lines 49 - 58,
Resolve the cross-thread race in the DR16 status state by making valid_ atomic
and using acquire/release semantics for its writes and reads. Update
store_status(), refresh_validity(), update_status(), and valid() consistently,
and synchronize last_remote_control_received_at_ as well—either protect both
fields with the same mutex or use an atomic time representation—while preserving
the existing validity and RemoteControl::update() behavior.

@creeper5820
creeper5820 merged commit ef4ef90 into dev/robotsJul 19, 2026
1 check passed
@github-project-automationgithub-project-automationBot moved this from Todo to Done in RMCSJul 19, 2026
@creeper5820
creeper5820 deleted the dev/VTM-link branch July 19, 2026 12:11
ZGZ713912 added a commit that referenced this pull request Jul 22, 2026
commit 4d1b9fc
Author: creeper5820 <cqq1960180796@163.com>
Date: Mon Jul 20 23:13:59 2026 +0800
feat: Refine auto-aim fire control and bringup configs
commit 94da5b9
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 20:18:47 2026 +0800
chore: Clean up code and apply format
commit eb9d651
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 19:09:06 2026 +0800
chore: Update auto aim submodule
commit ef4ef90
Author: FloatPigeon <floatpigeon@proton.me>
Date: Sun Jul 19 20:11:54 2026 +0800
feat: Add VT13 remote control and dual control arbitration (#93)
commit d49071c
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 11:09:07 2026 +0800
feat: Adapt rune single shoot mode
commit 91aaa6b
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:55:26 2026 +0800
fix: No response of switching item in scan-remote
commit b868fd3
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:35:00 2026 +0800
chore: Add auto aim as submodule
commit 0d84265
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:29:59 2026 +0800
merge(robot): Merge sentry impl into this branch
commit e588f08
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 11:20:01 2026 +0800
fix(hero): Update auto-aim config and should_control gating
commit 77444dd
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 10:37:57 2026 +0800
fix: Correct hero friction order
commit 768369c
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 08:55:39 2026 +0800
wip: Merge hero and infantry 3/4, remove unused robot
commit 5b9d180
Merge: fbe3ec51fd53eb
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 01:39:23 2026 +0800
Merge branch 'merge/hero' into merge/robots
commit 1fd53eb
Author: creeper5820 <cqq1960180796@163.com>
Date: Thu Jul 16 00:41:59 2026 +0800
chore: Modify hero config
commit 38f562d
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 21:12:29 2026 +0800
wip: Adapt auto aim control
commit 4a8722d
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 19:14:09 2026 +0800
wip: Adapt auto aim for hardware and clean config
commit de27628
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 15 22:32:11 2026 +0800
parameter changes for 12m/s
commit afda3ee
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 18:47:45 2026 +0800
wip: Rebase with main branch
commit 81a0232
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 15 15:16:50 2026 +0800
stable
commit 143cee6
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 8 23:39:08 2026 +0800
friction_sweep and parameter changes
commit 016bd08
Author: qzhhhi <zihanqin2048@gmail.com>
Date: Fri May 22 13:21:21 2026 +0800
vt13 test (rmcs_board need : chore(rmcs_board): Raise UART0 baudrate for temporary debugging by qzhhhi · Pull Request #55 · Allia)
commit 119730e
Author: dwx5 <1591215786@qq.com>
Date: Thu Jul 2 22:10:14 2026 +0800
1、lk_motor: multiple angle dynamically transform
2、interfere clean
3、six_friction: rename and reset parameter
4、putter return
commit 3c061e8
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 1 20:39:00 2026 +0800
six-friction
commit 8ad0751
Author: dwx5 <1591215786@qq.com>
Date: Sat Jun 6 20:11:57 2026 +0800
add yaw brake
commit f398929
Author: dwx5 <1591215786@qq.com>
Date: Thu Jun 4 21:08:50 2026 +0800
update after merge main
commit ad17156
Author: qzhhhi <zihanqin2048@gmail.com>
Date: Sun Jul 12 02:19:02 2026 +0800
feat: success buff
ZGZ713912 added a commit that referenced this pull request Jul 22, 2026
commit 0e1e1ad
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 22 03:12:17 2026 +0800
wip: Develop sentry navigation
commit 97020e1
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 22 02:12:15 2026 +0800
wip: Adjust 17mm bullet feeder behavior, improve rmcs host util and
update auto_aim
commit 4d1b9fc
Author: creeper5820 <cqq1960180796@163.com>
Date: Mon Jul 20 23:13:59 2026 +0800
feat: Refine auto-aim fire control and bringup configs
commit 94da5b9
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 20:18:47 2026 +0800
chore: Clean up code and apply format
commit eb9d651
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 19:09:06 2026 +0800
chore: Update auto aim submodule
commit ef4ef90
Author: FloatPigeon <floatpigeon@proton.me>
Date: Sun Jul 19 20:11:54 2026 +0800
feat: Add VT13 remote control and dual control arbitration (#93)
commit d49071c
Author: creeper5820 <cqq1960180796@163.com>
Date: Sun Jul 19 11:09:07 2026 +0800
feat: Adapt rune single shoot mode
commit 91aaa6b
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:55:26 2026 +0800
fix: No response of switching item in scan-remote
commit b868fd3
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:35:00 2026 +0800
chore: Add auto aim as submodule
commit 0d84265
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 17:29:59 2026 +0800
merge(robot): Merge sentry impl into this branch
commit e588f08
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 11:20:01 2026 +0800
fix(hero): Update auto-aim config and should_control gating
commit 77444dd
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 10:37:57 2026 +0800
fix: Correct hero friction order
commit 768369c
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 08:55:39 2026 +0800
wip: Merge hero and infantry 3/4, remove unused robot
commit 5b9d180
Merge: fbe3ec51fd53eb
Author: creeper5820 <cqq1960180796@163.com>
Date: Sat Jul 18 01:39:23 2026 +0800
Merge branch 'merge/hero' into merge/robots
commit 1fd53eb
Author: creeper5820 <cqq1960180796@163.com>
Date: Thu Jul 16 00:41:59 2026 +0800
chore: Modify hero config
commit 38f562d
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 21:12:29 2026 +0800
wip: Adapt auto aim control
commit 4a8722d
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 19:14:09 2026 +0800
wip: Adapt auto aim for hardware and clean config
commit de27628
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 15 22:32:11 2026 +0800
parameter changes for 12m/s
commit afda3ee
Author: creeper5820 <cqq1960180796@163.com>
Date: Wed Jul 15 18:47:45 2026 +0800
wip: Rebase with main branch
commit 81a0232
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 15 15:16:50 2026 +0800
stable
commit 143cee6
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 8 23:39:08 2026 +0800
friction_sweep and parameter changes
commit 016bd08
Author: qzhhhi <zihanqin2048@gmail.com>
Date: Fri May 22 13:21:21 2026 +0800
vt13 test (rmcs_board need : chore(rmcs_board): Raise UART0 baudrate for temporary debugging by qzhhhi · Pull Request #55 · Allia)
commit 119730e
Author: dwx5 <1591215786@qq.com>
Date: Thu Jul 2 22:10:14 2026 +0800
1、lk_motor: multiple angle dynamically transform
2、interfere clean
3、six_friction: rename and reset parameter
4、putter return
commit 3c061e8
Author: dwx5 <1591215786@qq.com>
Date: Wed Jul 1 20:39:00 2026 +0800
six-friction
commit 8ad0751
Author: dwx5 <1591215786@qq.com>
Date: Sat Jun 6 20:11:57 2026 +0800
add yaw brake
commit f398929
Author: dwx5 <1591215786@qq.com>
Date: Thu Jun 4 21:08:50 2026 +0800
update after merge main
commit ad17156
Author: qzhhhi <zihanqin2048@gmail.com>
Date: Sun Jul 12 02:19:02 2026 +0800
feat: success buff
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.

2 participants

@floatpigeon@creeper5820