Skip to content

Feat/feishu history - #37

Closed
heyeuu wants to merge 3 commits into
mainfrom
feat/feishu-history
Closed

Feat/feishu history#37
heyeuu wants to merge 3 commits into
mainfrom
feat/feishu-history

Conversation

@heyeuu

@heyeuu heyeuu commented Apr 22, 2026

Copy link
Copy Markdown
Member

Feishu历史记录和相机触发事件同步功能

本PR在系统中引入了共享内存历史记录机制和相机触发事件同步功能,用于实现精确的时间戳对齐和状态历史访问。

核心功能变更

共享内存基础设施增强

  • src/utility/shared/interprocess.hpp 中引入了 MappedContext RAII包装器,集中管理共享内存的映射生命周期
  • 实现了新的 HistoryClient<T, N> 模板类,提供环形缓冲区的共享内存通道,支持:
    • Send::push() - 写入数据到下一个序列号槽位
    • Recv::latest() - 读取最新数据
    • Recv::find_latest(Predicate) - 按条件查找最新匹配的历史数据
    • Recv::pop_next() - 按FIFO顺序读取数据

Feishu通信层重构

  • src/kernel/feishu.hpp 中添加了通用的 Channel<T> 包装类,支持对不同数据类型的一致处理
  • 引入了 ChannelTraits 模板,用于映射数据类型到相应的共享内存客户端
  • 新增 Feishu::fetch_latest_before(Clock::time_point) 方法,返回指定时刻之前的历史控制状态

相机触发事件系统

  • 定义了新的 CameraTriggerEvent 结构体,包含单调递增的序列号和时间戳
  • src/component.cpp 中实现了相机触发事件的发布和提交流程,包括:
    • 触发间隙检测和日志记录
    • 触发序列号的连续性验证
    • 提交失败时的限流日志

Capturer触发同步支持

  • src/kernel/capturer.cpp 中添加了 bind_trigger_timestamp 逻辑
  • 当启用触发同步时,自动从相机触发事件历史中查找与当前帧时间戳匹配的触发事件
  • 实现了缺失触发事件的有界警告机制

运行时集成

  • 更新了 src/runtime.cpp 的ROS2关闭处理,从信号处理改为ROS2的on_shutdown回调
  • 修改 fetch_control_state 以接收图像时间戳,通过 fetch_latest_before 获取历史控制状态
  • 改进了控制状态不可用时的警告机制

配置更新

  • config/config.yaml 中添加 enable_trigger_sync 开关
  • 更改 hikcamerafixed_frameratetrue

测试支持

  • 添加了 test/timestamp_alignment.cpp 测试套件,验证:
    • Clock类型为 std::chrono::steady_clock
    • HistoryClient的FIFO顺序和查询语义
    • Feishu的历史状态检索行为

代码更改统计

  • 总行数变更:+435/-112
  • 涉及文件8个
  • 主要影响模块:共享内存通信、组件控制、相机采集、系统运行时

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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: 2d064ef4-c332-44b6-a297-d069c2ac1ba6

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 feat/feishu-history

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.

@heyeuu
heyeuu marked this pull request as ready for review April 22, 2026 12:24
@heyeuu heyeuu closed this Apr 22, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in RMCS Auto Aim V2 Apr 22, 2026
@heyeuu heyeuu reopened this Apr 22, 2026
@heyeuu heyeuu closed this Apr 22, 2026
@heyeuu heyeuu reopened this Apr 22, 2026
@heyeuu heyeuu closed this Apr 22, 2026
Sign up for free to 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