Skip to content

feat(gimbal): use robot_center for dual-yaw targeting and tune PID params#84

Open
zlq04222 wants to merge 1 commit into
dev/sentryfrom
feat/gimbal-robot-center
Open

feat(gimbal): use robot_center for dual-yaw targeting and tune PID params#84
zlq04222 wants to merge 1 commit into
dev/sentryfrom
feat/gimbal-robot-center

Conversation

@zlq04222

@zlq04222 zlq04222 commented Jun 20, 2026

Copy link
Copy Markdown

功能变更

配置参数调整 (sentry.yaml)

云台硬件参数

  • 调整 pitch_motor_zero_point 从 12347 至 12158

云台控制器PID参数优化

  • 上层偏航角度PID:kp: 45.0 → 35.0ki: 0.0 → 0.008kd: 0.0 → 0.005
  • 上层偏航速度PID:ki: 0.0 → 0.00kd 保持 0.0(kp 保持 2.160)
  • 下层偏航角度PID:kp: 12.0 → 9.5ki: 0.0 → 0.001kd: 0.0 → 0.0003
  • 下层偏航速度PID:kp: 22.5 → 18.0ki/kd 保持 0.00/0.00)
  • 俯仰角度积分项:ki: 0.0 → 0.01

核心控制逻辑更新 (eccentric_dual_yaw.cpp)

双偏航自瞄目标计算改进

  • 新增 auto_aim_robot_center 输入接口,用于接收机器人中心点坐标
  • 自瞄模式下,计算相机位置到机器人中心的向量方向,作为 center_yaw
  • 下层偏航目标从直接使用瞄准yaw改为设置为计算的 center_yaw
  • 上层偏航目标从固定为0改为设置为期望瞄准yaw与 center_yaw 的有限角度差

自瞄启用条件增强

  • 新增对 auto_aim_robot_center 就绪状态的检查
  • 新增对机器人中心坐标非零且所有分量有限的验证

代码结构优化

  • 重新排列 apply_control() 方法中上下层偏航转矩的计算和赋值顺序(上层优先)

影响范围

  • Sentry哨兵机器人的云台控制参数配置
  • 自动瞄准系统的双偏航协调算法

@coderabbitai

coderabbitai Bot commented Jun 20, 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: d50d1bcb-a82d-4614-abfb-8de7c140a445

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/gimbal-robot-center

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

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
rmcs_ws/src/rmcs_core/src/controller/gimbal/eccentric_dual_yaw.cpp (1)

59-73: 请在接口文档或代码注释中明确 auto_aim_robot_center 输入的坐标系要求。

代码在第 61-65 行假设 auto_aim_robot_centercamera_pos 处于同一坐标系(OdomImu),才能正确计算差值向量。虽然 enable_autoaim() 对该输入进行了有效性检查(ready、非零、有限性),但并未验证坐标系的兼容性。建议在接口文档或代码注释中明确该输入必须在 OdomImu 坐标系中,以防止上游发布者使用不同坐标系导致的潜在问题。

🤖 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/gimbal/eccentric_dual_yaw.cpp` around
lines 59 - 73, The code assumes that `auto_aim_robot_center` is in the OdomImu
coordinate system when computing the difference vector with `camera_pos`, but
this requirement is not documented. Add a clear comment or documentation note
above the section where `auto_aim_robot_center` is retrieved and used (around
where it is assigned to `robot_center`) to explicitly state that this input must
be provided in the OdomImu coordinate system to ensure correct calculations.
This clarification should help prevent upstream publishers from accidentally
providing data in mismatched coordinate frames.
🤖 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 `@rmcs_ws/src/rmcs_core/src/controller/gimbal/eccentric_dual_yaw.cpp`:
- Around line 59-73: The code assumes that `auto_aim_robot_center` is in the
OdomImu coordinate system when computing the difference vector with
`camera_pos`, but this requirement is not documented. Add a clear comment or
documentation note above the section where `auto_aim_robot_center` is retrieved
and used (around where it is assigned to `robot_center`) to explicitly state
that this input must be provided in the OdomImu coordinate system to ensure
correct calculations. This clarification should help prevent upstream publishers
from accidentally providing data in mismatched coordinate frames.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6e952079-53f9-4a18-80cb-a32cbaa8afab

📥 Commits

Reviewing files that changed from the base of the PR and between 9d88007 and 00c0c19.

📒 Files selected for processing (2)
  • rmcs_ws/src/rmcs_bringup/config/sentry.yaml
  • rmcs_ws/src/rmcs_core/src/controller/gimbal/eccentric_dual_yaw.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant