Skip to content

wip: visual and pnp#57

Merged
creeper5820 merged 3 commits into
mainfrom
wip/visual-and-pnp
Jun 7, 2026
Merged

wip: visual and pnp#57
creeper5820 merged 3 commits into
mainfrom
wip/visual-and-pnp

Conversation

@creeper5820

@creeper5820 creeper5820 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

摘要

该PR对视觉和PnP求解系统进行了多项优化和功能增强。

核心改动

可视化系统升级

  • 灯条可视化支持:新增 Lightbars 类用于批量管理和发布灯条三维可视化,支持按名称缓存对应的ROS2发布器,并能够生成LINE_LIST类型的Marker进行可视化渲染。
  • 相机位姿接口统一:将 Visualization::update_camera_pose 的参数从单纯的 Orientation 改为接收完整的 Transform 对象,以支持位姿的整体更新。
  • 标记显示时长调整:调整装甲和箭头标记的显示时长为0.5秒,使得可视化效果更加一致。

PnP求解算法优化

  • 简化候选筛选逻辑:移除基于欧拉角幅度的"过大偏转"剪枝逻辑,仅保留背向剔除和Pitch合理性检验。
  • 参数精简:移除了 RobustPnpSolution::Input 中的 max_yaw_pitch 成员,简化输入配置。
  • 改进Pitch计算:优化了重投影优化阶段中原始Pitch的初始计算方式。

姿态估计改进

  • 前哨站几何计算重写:将 NeighborBarSolution::solve() 中的几何计算逻辑从基于坐标轴推导改为基于装甲板姿态四元数与平移量进行计算,提高了计算的数值稳定性。
  • 灯条坐标系优化:调整灯条y轴的基准向量计算方式。
  • 可视化颜色简化:在调试绘制中将动态颜色计算替换为固定的绿色标量。

运行时优化

  • 时间戳偏移调整:将图像时间戳匹配飞书数据的时间偏移从 -6'250'000ns 调整为 -8'200'000ns
  • 相机位姿更新方式改变:运行时中的相机位姿更新改为直接使用完整的 camera_transform 而非仅使用orientation。
  • 渲染顺序调整:交换了检测结果和区域的渲染顺序。
  • 前哨站角速度计算:移除了角速度计算中的0.1倍数因子,直接使用标定的角速度值。

工具和格式改进

  • 日志输出格式:更新Eigen类型(Vector3d、Quaterniond)的格式化输出,使其显示带有显式的正负号。
  • 配置管理:在.gitignore中新增对Unreal引擎本地配置文件的忽略规则。
  • .hpp注释清理:移除了CameraFeature结构体中的冗余注释。

- Add Lightbars visualization via MarkerArray
- Rewrite outpost neighbor armor position solver
- Remove yaw/pitch pruning from PnP, stop abs on pitch
- Pass Transform instead of Orientation to update_camera_pose
- Unify marker lifetimes to 0.5s
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@creeper5820, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e1770a78-c697-47be-af0b-5dc5985b56af

📥 Commits

Reviewing files that changed from the base of the PR and between 24fa019 and fb3792f.

📒 Files selected for processing (1)
  • config/config.yaml

Walkthrough

PR 新增灯条批量发布系统 Lightbars,升级相机位姿接口从 OrientationTransform,重构前哨站几何算法,简化 PnP 求解器的候选剪枝逻辑,并调整可视化参数与渲染流程。

Changes

灯条发布与位姿接口升级及几何算法优化

Layer / File(s) Summary
Lightbars 批量发布系统新增
src/utility/rclcpp/visual/lightbar.hpp, src/utility/rclcpp/visual/lightbar.cpp, src/kernel/visualization.cpp
新增 Lightbars 结构体与配置接口,实现 MarkerArray 发布、生命周期与移动语义;在 Visualization 中新增 publish(std::span<const Lightbar3d>) 重载及内部发布器缓存。
相机位姿接口 Orientation → Transform 升级
src/kernel/visualization.hpp, src/kernel/visualization.cpp, src/runtime.cpp
Visualization::update_camera_pose 参数改为接受 Transform 类型,实现层直接使用 translation 与 orientation 字段;运行时调用传入完整 camera_transform 对象。
前哨站几何计算算法重构
src/utility/math/outpost.cpp
NeighborBarSolution::solve() 重写几何推导逻辑,基于装甲板四元数与平移计算 rotation_center/vertical 等中间向量,替换原有 horizon_toward/vertical_axis 方案;灯条坐标系 y_axis 基准改为新 vertical
PnP 求解器剪枝逻辑精简
src/utility/math/solve_pnp/pnp_solution.hpp, src/utility/math/solve_pnp/pnp_solution.cpp
移除 max_yaw_pitch 输入参数;删除相机系欧拉角幅度限制剪枝,仅保留背向剔除与 Odom Pitch 检查;调整重投影初始 Pitch 直接取 ypr[1];显式转换 yaw 步数为 int
位姿估计器前哨站分支与灯条处理
src/kernel/pose_estimator.cpp
前哨站分支移除 result->found 的拷贝,保留 predicted_*/center 赋值;启用朝向覆盖(result.armor.orientation = outpost_in_camera.orientation);绘制颜色改为固定绿色;用投影引用生成 detected_2d 坐标。
可视化参数与渲染顺序调整
src/utility/rclcpp/visual/armor.cpp, src/runtime.cpp, src/utility/math/camera.hpp
装甲/箭头 Marker lifetime 统一为 0.5 秒;运行时渲染顺序调整(detected_2d 先于 areas);移除 CameraFeature 的 ROS 约定注释。
工具函数与配置微调
src/utility/logging/eigen.hpp, tool/cxx/see_outpost.cpp, .gitignore
Eigen 类型格式化显式显示正号;出post视觉工具移除角速度 0.1 倍数;.gitignore 新增 Unreal 配置忽略项。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement


🐰 灯条闪闪亮,Transform 展新章,

几何算法精心藏,PnP 剪枝更简洁,

可视化调谐响叮当,自动瞄准向前方! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 标题「wip: visual and pnp」过于宽泛且缺乏具体信息,未能准确总结本次变更的主要内容。PR涉及多个文件的重要改动(如出站站优化、灯条可视化、PnP筛选逻辑等),但标题仅用两个简略词汇「visual」和「pnp」含糊其辞。 建议使用更具体的标题,例如「优化出站站装甲估计和PnP筛选逻辑;新增灯条可视化功能」,以准确概括主要变更。
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check 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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wip/visual-and-pnp

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/utility/logging/eigen.hpp (1)

26-27: 💤 Low value

建议统一所有 Eigen 格式化器的符号显示风格。

Vector3dQuaterniond 的精度格式已更新为显式显示正负号(:+.{}f),但 AngleAxisd(Line 49-51)和 Isometry3d(Line 66-68)仍使用默认的无符号格式(:.{}f)。为保持日志输出的一致性,建议所有格式化器在启用精度时统一使用相同的符号显示策略。

♻️ 建议的统一方案

如果希望所有格式化器都显示符号,可对 AngleAxisdIsometry3d 应用相同的 :+ 格式:

AngleAxisd (Line 49-51):

-            return std::format_to(ctx.out(), "(angle={:.{}f}, axis=({:.{}f}, {:.{}f}, {:.{}f}))",
-                aa.angle(), precision, axis.x(), precision, axis.y(), precision, axis.z(),
-                precision);
+            return std::format_to(ctx.out(), "(angle={:+.{}f}, axis=({:+.{}f}, {:+.{}f}, {:+.{}f}))",
+                aa.angle(), precision, axis.x(), precision, axis.y(), precision, axis.z(),
+                precision);

Isometry3d (Line 66-68):

             return std::format_to(ctx.out(),
-                "T: ({:.{}f}, {:.{}f}, {:.{}f}), Q: (w={:.{}f}, {:.{}f}, {:.{}f}, {:.{}f})", t.x(),
+                "T: ({:+.{}f}, {:+.{}f}, {:+.{}f}), Q: (w={:+.{}f}, {:+.{}f}, {:+.{}f}, {:+.{}f})", t.x(),
                 precision, t.y(), precision, t.z(), precision, q.w(), precision, q.x(), precision,

Also applies to: 37-37

🤖 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 `@src/utility/logging/eigen.hpp` around lines 26 - 27, Update the Eigen
formatters so sign display is consistent: change the format specifiers used in
the AngleAxisd and Isometry3d formatters to include the explicit plus sign flag
(use :+.{}f like in the Vector3d and Quaterniond formatters) so positive values
render with a leading '+' when precision is enabled; locate and modify the
formatting calls inside the AngleAxisd and Isometry3d formatter functions to
mirror the Vector3d/Quaterniond specifiers and keep precision handling
identical.
🤖 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.

Nitpick comments:
In `@src/utility/logging/eigen.hpp`:
- Around line 26-27: Update the Eigen formatters so sign display is consistent:
change the format specifiers used in the AngleAxisd and Isometry3d formatters to
include the explicit plus sign flag (use :+.{}f like in the Vector3d and
Quaterniond formatters) so positive values render with a leading '+' when
precision is enabled; locate and modify the formatting calls inside the
AngleAxisd and Isometry3d formatter functions to mirror the Vector3d/Quaterniond
specifiers and keep precision handling identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec08c2b3-0d17-443d-be21-d9d5abae5a30

📥 Commits

Reviewing files that changed from the base of the PR and between edb563f and 24fa019.

📒 Files selected for processing (14)
  • .gitignore
  • src/kernel/pose_estimator.cpp
  • src/kernel/visualization.cpp
  • src/kernel/visualization.hpp
  • src/runtime.cpp
  • src/utility/logging/eigen.hpp
  • src/utility/math/camera.hpp
  • src/utility/math/outpost.cpp
  • src/utility/math/solve_pnp/pnp_solution.cpp
  • src/utility/math/solve_pnp/pnp_solution.hpp
  • src/utility/rclcpp/visual/armor.cpp
  • src/utility/rclcpp/visual/lightbar.cpp
  • src/utility/rclcpp/visual/lightbar.hpp
  • tool/cxx/see_outpost.cpp
💤 Files with no reviewable changes (2)
  • src/utility/math/camera.hpp
  • src/utility/math/solve_pnp/pnp_solution.hpp

@creeper5820 creeper5820 merged commit c287923 into main Jun 7, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in RMCS Auto Aim V2 Jun 7, 2026
@creeper5820 creeper5820 deleted the wip/visual-and-pnp branch June 7, 2026 16:26
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