Fix: address issues in #25 regarding ballistics calculation#30
Fix: address issues in #25 regarding ballistics calculation#30
Conversation
Enabled real-time 3D visualization of predicted armor plates in the world coordinate system, allowing for intuitive debugging via Foxglove Studio.
Walkthrough本次变更移除可配置的重力参数并改为私有常数,将火控轨迹估计相关签名及实现调整;同时把 Changes
Sequence Diagram(s)sequenceDiagram
participant Camera as 摄像机/输入帧
participant Runtime as Runtime 管道
participant Detection as 装甲识别
participant PnP as PnP 求解器
participant Tracker as 追踪器
participant FireCtrl as 火控 系统
participant Feishu as Feishu 服务
Camera->>Runtime: 新帧
Runtime-->>Runtime: fetch_control_state()
Runtime->>Detection: detect_armors()
Detection-->>Runtime: 2D 检测结果
Runtime->>PnP: solve_pnp(2D 检测)
PnP-->>Runtime: 3D 装甲位姿
Runtime->>Tracker: track_armors(3D 数据)
Tracker-->>Runtime: 跟踪快照
Runtime->>FireCtrl: execute_fire_control(跟踪数据)
FireCtrl-->>Runtime: 射击解
Runtime->>Feishu: commit_result(自动瞄准状态)
Runtime->>Runtime: visualize_detection()/visualize_prediction()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/module/fire_control/trajectory_solution.cpp (1)
6-13:⚠️ Potential issue | 🟡 Minor文档注释中仍引用已移除的参数
g第 11 行
@param g 重力加速度对应的参数已被移除(改为内部常量kGravity),但注释未同步更新。🔧 建议修复
/** * `@brief` 弹道解算 (考虑空气阻力迭代) * `@param` v0 子弹初速度 (m/s) * `@param` target_d 水平距离 (m) * `@param` target_h 目标竖直高度 (m) - 目标在枪口上方为正 - * `@param` g 重力加速度 * `@param` params 系数 * 参考资料:https://zhuanlan.zhihu.com/p/1970271417149920247 */
🤖 Fix all issues with AI agents
In `@src/utility/math/kalman_filter/ekf.hpp`:
- Line 2: 在 ekf.hpp 中当前只包含 <eigen3/Eigen/Geometry>,但后续在 S.ldlt().solve()
的模板实例化(例如在 robot_state.cpp 中)需要 Cholesky/LDLT 支持;将头文件改为包含
<eigen3/Eigen/Dense>(或同时保留 Geometry 并新增 <eigen3/Eigen/Cholesky>)以确保
LDLT/Cholesky 分解可用,从而修复 S.ldlt().solve() 的编译错误。
🧹 Nitpick comments (1)
src/module/fire_control/trajectory_solution.hpp (1)
32-35: 常量命名中的拼写问题(已有代码)
kMaxPitchThreold、kHeightErrorThreold、kEstimateTimeOutThreold中 "Threold" 应为 "Threshold"。这是预先存在的拼写问题,建议在方便时统一修正。
The call to `S.ldlt().solve()` at line 133 requires the Cholesky module, which is not provided by `Eigen/Geometry`. - Re-add `Eigen/Cholesky` to ensure the template can be instantiated. - Resolve the compilation error in `robot_state.cpp` that occurs when `Eigen/Dense` is not previously included in the chain. - Maintain `Eigen/Geometry` for rotation and quaternion operations.
修复:解决 #25 中关于弹道计算的问题
核心改动
本 PR 通过简化重力处理和重构运行时管道,修复并优化了弹道计算相关逻辑,提升可维护性与错误隔离。
弹道计算与配置
g。FireControl::Impl::Config中的g字段以及TrajectoryParams的g成员。Estimate(v0, pitch, d, k, g)→Estimate(v0, pitch, d, k),并在垂直速度更新中用 kGravity 替代原来的 g 参数。运行时结构重构
其他变更
对外 API 与行为影响
备注