docs: polish MaixCAM2 xAI section headings

Co-authored-by: taorye <taorye@outlook.com>
This commit is contained in:
liangziyue
2026-07-28 16:41:09 +08:00
parent c28dcfc1ef
commit 6a13bd0df9
2 changed files with 31 additions and 31 deletions

View File

@@ -4,7 +4,7 @@ title: "MaixCAM2 x AI: Build a Two-Axis Gimbal Tracker with an AI Agent"
This page uses a real MaixCAM2 development recording as an example to show how to use an AI Agent to build a UART4 two-axis gimbal red-object tracker with the MaixCAM2 built-in camera. The recording used Codex with MCP to call maixpy-skill. To make the setup easier to reproduce on Windows, macOS, and Linux, this page only demonstrates OpenCode for installation and model configuration. The Codex and MCP UI shown in some images is only from the recorded session and is not the OpenCode interface.
## Final Result
## Project Goal and Final Result
The goal is to detect a red object in the camera image and keep it near the center of the frame by driving a two-axis gimbal.
@@ -20,7 +20,7 @@ When the object moves, the gimbal adjusts accordingly. This is the target behavi
If the embedded video does not play, open it on Bilibili: [MaixCAM2 x MCP auto debugging video tutorial](https://www.bilibili.com/video/BV13W3w6REa2/).
## Choose an AI Agent
## Choose an AI Agent for Development
You can use Codex, Claude Code, or OpenCode. The recorded Agent was Codex + MCP, while this page only covers OpenCode installation and configuration to avoid duplicating multiple Agent interfaces. The later task description, device connection, and acceptance workflow do not depend on the Agent UI shown in the recording.
@@ -49,7 +49,7 @@ Steps:
Note: the download page and client UI may change over time. Follow the system packages and versions shown on the current official download page.
### Install cc-switch and Configure the OpenCode Model
### Install cc-switch and Configure OpenCode Models
Purpose: use cc-switch to manage OpenCode providers and model settings.
@@ -96,7 +96,7 @@ Steps:
After uv is installed, continue by asking the Agent to install maixpy-skill. If maixpy-skill later needs a Python version or extra Python packages, the Agent will manage them through uv instead of modifying the system Python environment directly.
## Download and Install maixpy-skill
## Install maixpy-skill
Purpose: give the Agent the workflows and device operation capabilities needed for MaixCAM series development.
@@ -144,7 +144,7 @@ The MaixCAM2 quick-start documentation explains that the device needs network ac
Note: UART4 pin mapping, servo IDs, power requirements, and protocol details depend on the gimbal model. Do not treat values from a reference project as universal settings.
## Describe the Requirement and Submit Task 1 to the AI
## Submit the Initial Development Request
Purpose: provide the goal, reference project, validation order, safety constraints, and final behavior in one message, reducing guesses on critical conditions.
@@ -170,11 +170,11 @@ Replace `[device address]` with the current device address and send:
Note: do not publish private LAN addresses, passwords, or access tokens in public documentation. The reference project is used to understand the protocol and project structure. Direction, center position, limits, color thresholds, and control parameters must be validated again on the current hardware.
## Wait for Task 1 to Finish and Guide the AI When Needed
## Step-by-Step Debugging and Manual Confirmation
Task 1 should be completed in stages, with the Agent reporting each result. When the Agent cannot determine the actual hardware state through APIs, the user should provide observations such as "the positive horizontal command actually turns right" or "the gimbal hits the bracket at this position".
### Confirm Small Gimbal Movement
### Gimbal Micro-Movement and Direction Calibration
Purpose: confirm that both axes can communicate, move slightly, return to center, and establish local safety constraints.
@@ -195,7 +195,7 @@ Pass criteria: both axes are online, directions are recorded, the gimbal can ret
The image shows the gimbal and device feedback. The recording alone is not enough to prove that servo firmware limits were finally read successfully; this should be confirmed separately in the runtime logs.
### Red-Object Detection Unit Test Passes
### Red-Object Detection Verification
Purpose: confirm that the vision input is correct before adding gimbal control.
@@ -215,7 +215,7 @@ Pass criteria: the target can be repeatedly detected and coordinates can be obta
The device screen shows the red target detection box. The exact threshold, bounding box, and frame-rate values should be confirmed from the current runtime logs and debug images.
### Add Three-Stage Closed-Loop Control
### Add the Three-Stage Closed-Loop Control Strategy
Purpose: let the two-axis gimbal track the target according to the error between the object and the frame center, while avoiding overshoot from high-speed movement and oscillation near the center.
@@ -235,7 +235,7 @@ Each axis should maintain its own direction mapping, limits, speed, acceleration
The Agent is investigating possible causes such as "movement too aggressive". The recording alone cannot prove all three-stage gain parameters; the actual parameters should be confirmed in the source code or logs.
### First Closed Loop: Target Lost
### Correct the Closed-Loop Direction Mapping
After directly using the reference implementation, the real installation direction did not match the expected direction. The gimbal moved in the wrong direction and the target left the trackable range.
@@ -254,7 +254,7 @@ Debugging steps:
Note: before direction is confirmed, do not tune PID, speed, or thresholds first. Otherwise, it is hard to tell whether the issue is wrong control direction or bad parameters.
### Fix Oscillation and Overshoot
### Suppress Oscillation and Overshoot
After fixing the pitch direction, the gimbal still oscillated left and right when the target was static. After further tuning, tracking became stable.
@@ -276,7 +276,7 @@ Recommended order:
<img src="../../assets/maixcam/maixcam2_xai/09_stable_tracking.jpg" alt="Figure 11: Stable tracking after the fix. Source: this recording, cropped to show the gimbal and target." width="640" style="max-width: 100%; height: auto;">
</p>
## Submit Task 2: Automated Test Passes
## Automated Position Regression Test
Purpose: use repeatable fixed-position tests instead of relying on "it looks fine once".
@@ -302,7 +302,7 @@ Check:
The recording also includes multiple repeated position checks. If you publish a more complete acceptance report, consider adding screenshots or a result table from those clips.
## Confirm the Result and Submit Task 3
## Finalize the Implementation and Run Dynamic Acceptance Testing
After the automated test passes, freeze the current implementation as the final dynamic tracking version, then perform manual dynamic testing.
@@ -324,7 +324,7 @@ Pass criteria: both axes move in the correct direction; far targets can be chase
<img src="../../assets/maixcam/maixcam2_xai/11_final_tracking.gif" alt="Figure 14: Final dynamic tracking acceptance. Source: this recording, cropped as a looped animation." width="640" style="max-width: 100%; height: auto;">
</p>
## Accept and Collect Deliverables
## Acceptance Results and Deliverable Archive
After acceptance, collect these deliverables from the Agent:
@@ -337,7 +337,7 @@ After acceptance, collect these deliverables from the Agent:
When checking the deliverables, confirm that continuous debug-image saving is disabled in the release version, that the application has a graceful exit path, and that it restores the MaixCAM2 built-in camera pass-through display after exit as required.
## Task Template
## General Task Template
Replace the bracketed fields with your own project requirements:

View File

@@ -4,7 +4,7 @@ title: MaixCAM2 x AI用 AI Agent 开发二轴云台物块追踪
本文以一次实际录制的 MaixCAM2 开发过程为例,说明如何使用 AI Agent 开发基于 MaixCAM2 内置摄像头的 UART4 二轴云台红色物块追踪器。本次录制使用 Codex 通过 MCP 调用 maixpy-skill为方便 Windows、macOS 和 Linux 用户复刻,安装与模型配置部分只演示 OpenCode。图中的 Codex 与 MCP 界面用于呈现实录过程,不是 OpenCode 的操作界面。
## 最终效果
## 项目目标与最终效果
目标是识别画面中的红色物块,并让两轴云台持续将物块保持在画面中心附近。
@@ -20,7 +20,7 @@ title: MaixCAM2 x AI用 AI Agent 开发二轴云台物块追踪
如果页面内视频无法播放,可以打开 B 站视频:[【电赛特辑】MaixCAM2 x MCP 自动调试之视频详解](https://www.bilibili.com/video/BV13W3w6REa2/)。
## 选择 AI Agent
## 选择开发用 AI Agent
可使用 Codex、Claude CodeCC或 OpenCode。实录中的 Agent 是 Codex + MCP本文只展开 OpenCode 的安装和配置,避免重复介绍多个 Agent 的界面。后续任务描述、设备连接和验收步骤不依赖图中的 Agent 界面。
@@ -49,7 +49,7 @@ Agent 至少需要具备以下能力:
注意:下载页和客户端界面会随版本变化;以官方下载页当前显示的系统包和版本为准。
### cc-switch 安装 OpenCode 模型配置
### cc-switch 安装 OpenCode 模型配置
目的:使用 cc-switch 管理 OpenCode 的服务商和模型配置。
@@ -66,7 +66,7 @@ cc-switch 官方仓库说明其支持 Windows、macOS、Linux并包含 OpenCo
<img src="../../assets/maixcam/maixcam2_xai/02_ccswitch_home.png" alt="图 3cc-switch 官方主页及配置管理界面示意。来源ccswitch.io。" width="640" style="max-width: 100%; height: auto;">
</p>
### uv安装
### uv 安装
目的:为后续安装和运行 maixpy-skill 准备 Python 环境管理工具。
@@ -96,7 +96,7 @@ maixpy-skill 在安装和执行设备辅助脚本时需要 Python 运行环境
安装完成后,继续让 Agent 安装 maixpy-skill。后续如果 maixpy-skill 需要 Python 版本或额外 Python 包Agent 会通过 uv 管理依赖,而不是直接修改系统 Python 环境。
## 下载并安装 maixpy-skill
## 安装 maixpy-skill
目的:让 Agent 获得 MaixCAM 系列设备开发所需的工作流和设备操作能力。
@@ -145,7 +145,7 @@ MaixCAM2 快速开始文档说明,首次使用需连接网络;连接 Wi-Fi
注意UART4 的具体引脚映射、舵机 ID、供电规格和协议取决于云台型号。本文不把参考工程中的数值视为通用配置。
## 说明需求,提交任务一给 AI
## 提交初始开发需求
目的:一次性提供目标、参考工程、验证顺序、安全约束和最终行为,减少 Agent 在关键条件上猜测。
@@ -171,11 +171,11 @@ MaixCAM2 快速开始文档说明,首次使用需连接网络;连接 Wi-Fi
注意:不要将内网地址、密码或访问令牌发布到公开文档。参考项目用于理解协议和工程结构;当前硬件的方向、中心、限位、颜色阈值和控制参数必须重新验证。
## 等待任务一完成,必要时补充信息引导 AI
## 分阶段调试与人工确认
任务一应由 Agent 分阶段完成并汇报每一步结果。用户在 Agent 无法从接口确定实际硬件状态时补充观察结果,例如“水平轴正向命令实际向右转”或“云台到某位置会碰到支架”。
### 微控云台确认可动
### 云台微动与方向校准
目的:确认两个轴可通信、可小幅运动、可回中,并建立本机的安全约束。
@@ -196,7 +196,7 @@ MaixCAM2 快速开始文档说明,首次使用需连接网络;连接 Wi-Fi
画面可见云台与设备反馈。录像不足以证明最终成功读取了舵机固件限位;此项应在运行日志中单独确认。
### 红色物块检测单测通过
### 红色物块检测验证
目的:在接入云台控制前确认视觉输入正确。
@@ -216,7 +216,7 @@ MaixCAM2 快速开始文档说明,首次使用需连接网络;连接 Wi-Fi
设备屏幕显示红色目标的检测框。检测阈值、识别框和帧率的具体数值需以当前运行日志和调试图为准。
### 接入三段式闭环控制
### 接入三段式闭环控制策略
目的:让两轴云台依据物块相对画面中心的误差追踪目标,同时避免高速运动带来的超调和近中心摆动。
@@ -236,7 +236,7 @@ MaixCAM2 快速开始文档说明,首次使用需连接网络;连接 Wi-Fi
Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像无法单独证明三段式增益的全部参数,实际参数需在工程源码或日志中确认。
### 首次闭环:追丢
### 闭环方向映射修正
直接使用参考实现后,实际安装方向不一致,云台向错误方向运动,目标离开可追踪范围。
@@ -255,7 +255,7 @@ Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像
注意:方向未确认前,不应先调 PID、速度或阈值否则无法区分是控制方向错误还是参数问题。
### 修复摆动超调
### 抑制摆动超调
俯仰方向修复后,目标静止时云台仍在两侧来回摆;继续调整后,追踪恢复稳定。
@@ -277,7 +277,7 @@ Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像
<img src="../../assets/maixcam/maixcam2_xai/09_stable_tracking.jpg" alt="图 11修复后的稳定追踪。来源本次实录裁剪保留云台和目标。" width="640" style="max-width: 100%; height: auto;">
</p>
## 提交任务二:自动化测试通过
## 自动化位置回归测试
目的:用可重复的固定位置测试替代“一次看起来正常”的主观判断。
@@ -303,7 +303,7 @@ Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像
录制中还保留了多轮重复位置验证。若发布更完整的验收报告,建议补充这些片段中的截图或结果表。
## 肯定效果,提交任务三
## 固化最终实现并进行动态验收
自动化测试通过后,将当前实现固化为最终动态跟随版本,再进行人工动态测试。
@@ -325,7 +325,7 @@ Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像
<img src="../../assets/maixcam/maixcam2_xai/11_final_tracking.gif" alt="图 14最终动态跟随验收。来源本次实录裁剪为循环动图。" width="640" style="max-width: 100%; height: auto;">
</p>
## 验收通过,获取交付物
## 验收结果与交付物归档
验收通过后,应从 Agent 获取:
@@ -338,7 +338,7 @@ Agent 正在针对追踪行为排查“动作过猛”等可能原因。录像
检查交付时,应确认正式版本已关闭持续保存调试图片,应用具备正常退出路径,并按需求恢复 MaixCAM2 内置摄像头直传显示。
## 任务模板
## 通用任务模板
将方括号替换为自己的项目需求: