diff --git a/ASSET_LICENSES.md b/ASSET_LICENSES.md index 855ce20..7ca421e 100644 --- a/ASSET_LICENSES.md +++ b/ASSET_LICENSES.md @@ -71,3 +71,7 @@ ## SPR 2027 地图 `resources/images/rmuc2027.*`、`rmul3v3.*` 和 `rmul1v1.*` 依据 RoboMaster 高校赛务发布的 [RMU 2027 场地图纸与可移动道具](https://bbs.robomaster.com/article/1970956) 制作。SPR 调整了俯视角度、材质、照明和显示配色,SVG 小地图按场地结构重绘。地图按 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 提供,复用时应标注原作者、出处与改动,并遵守非商业及相同方式共享条款。 + +## README 运行截图 + +`docs/images/readme/` 展示 SPR 客户端的指挥屏、操作手 HUD 和全屏战况。截图由 SPR 从 `test_mainwindow_tactical_hotkey_integration.cpp` 的本机测试画面截取。队伍状态、计时和血量由测试填充,主图传截图使用仓库已登记的 `resources/images/tactical_camera_preview_default.png` 作为演示帧。画面内的地图和其余资源继续适用各自许可。地图署名和授权见上一节。 diff --git a/README.en.md b/README.en.md index df33088..189201f 100644 --- a/README.en.md +++ b/README.en.md @@ -2,30 +2,81 @@ [简体中文](README.md) · [English](README.en.md) -SPR's RoboMaster 2027 custom terminal, developed from [Fudan EGA's RM26 Custom Client](https://github.com/ClearWei/RM26_Client). The C++ and Qt source is available under the [MIT License](LICENSE). See the [asset register](ASSET_LICENSES.md) for media provenance. +A **RoboMaster 2027 custom client** maintained by the China University of Petroleum (Beijing) SPR team. Pilots can monitor their robot and match state over the main video feed. The command screen brings together both rosters, the arena map, battlefield events and the industrial camera. The project builds on Fudan EGA's RM26 Custom Client. [Upstream project](https://github.com/ClearWei/RM26_Client) -## Current client +[Match profiles](#match-profiles) · [Client views](#client-views) · [SPR changes](#spr-2027-changes) · [Quick start](#quick-start) · [Integration and verification](#integration-and-verification) -- Press `P` to choose RMUC, RMUL 3v3 or RMUL 1v1 and select the assigned red or blue seat. -- The command screen combines the arena map, both rosters, objectives, match events and the industrial camera preview. Press `M` for the expanded map. -- Use `Ctrl+T` to switch between the pilot video and command views. Hold `Tab` for match statistics. Heavy robot effects follow the logged-in team. [Keyboard shortcuts](docs/getting-started/keyboard-shortcuts.md) +> The screenshots show the running client with local test data. Windows and Ubuntu builds and automated tests have passed. Integration with the official 2027 engine, venue network and video hardware is pending. -## Official references +![RMUC command screen with the arena map, red and blue rosters, and match events](docs/images/readme/command-rmuc.png) -The 2027 implementation references the [communication protocol](https://bbs.robomaster.com/wiki/20204847/1969151), the [RMUC rulebook](https://bbs.robomaster.com/wiki/20204847/1969149) and the [RMUL rulebook](https://bbs.robomaster.com/wiki/20204847/1969150). The arena images are derived from the [official 2027 field drawings](https://bbs.robomaster.com/article/1970956), under the terms recorded in the [asset register](ASSET_LICENSES.md). +## Match profiles + +Press `P`, choose the competition profile, then select the assigned red or blue seat. These are the seats offered by the login menu. The roster can also display other robots reported by the match data. Blue wire IDs are the corresponding red IDs plus 100. + +| Profile | Config value | Arena | Login seats | +| --- | --- | --- | --- | +| RMUC | `rmuc2027` | 28 × 15 m | Heavy 1, infantry 3 and 4, aerial system 6 | +| RMUL 3v3 | `rmul3v3` | 12 × 8 m | Heavy 1 and infantry 3 | +| RMUL 1v1 | `rmul1v1` | 5 × 5 m | Infantry 3 | + +[3v3 command screen](docs/images/readme/command-rmul-3v3.png) · [1v1 command screen](docs/images/readme/command-rmul-1v1.png) + +## Client views + +| View | What it shows | How to open it | +| --- | --- | --- | +| Pilot settings | Competition profile and seat selection. Team-specific indicators follow the selected seat. | `P` | +| Command screen | Match clock, score, both rosters, arena map, objective health where applicable, match events and a camera preview. | `Ctrl+T` switches between the command screen and pilot video. | +| Map or industrial-camera priority | The central area switches between the map and camera. A secondary map remains available in camera-priority mode. | `Ctrl+Y` on the command screen | +| Pilot video | A full-screen video feed with the shared match header, robot HUD, minimap and interaction prompts. | `Ctrl+T` | +| Full-screen match status | Both rosters and match statistics. RMUC shows base and outpost health, while RMUL includes the arena map. | Hold `Tab`. Release it or press `Esc` to close. | +| Expanded map | Arena geometry, reported locations and objective state for the selected profile and team perspective. | `M` | +| Role panels and match results | Ammo supply, exchange or role-specific actions where available. Results can be dismissed via the close button or `Esc`. | `O`, `I` or `H` from pilot view, depending on the action | + +The video background below is a test frame. The HUD is drawn by the client. [Keyboard shortcuts and role controls](docs/getting-started/keyboard-shortcuts.md) + +![RMUC pilot view with the shared match header, crosshair, robot status and minimap](docs/images/readme/pilot-rmuc.png) + +## SPR 2027 changes + +- The client uses distinct RMUC, RMUL 3v3 and RMUL 1v1 seat lists, layouts and maps. The map orientation follows the logged-in team. +- The redesigned command screen combines rosters, current robot status, battlefield events and a choice of map or industrial-camera priority. The pilot HUD and full-screen match status share the match information with the command screen. +- Selected 2027 messages feed objectives, control, robot state, positions and timing into the UI. Unknown or unavailable values show a placeholder. +- The logged-in team's heavy card displays an unlock indicator, a transition animation after installation confirmation, and a gold completed state. The other team's heavy card uses the regular presentation. The public `Event 16` does not define a team or robot ID, so the client uses attributable data for team-specific effects. +- Windows and Linux launch tooling, Windows dependency detection and network restoration support the existing local runtime kit. Test coverage includes profile layouts, seat changes, keyboard shortcuts and heavy-robot effects. [Changelog](CHANGELOG.md) + +![RMUC match status from blue seat 3, where the blue heavy card indicates a confirmed installation](docs/images/readme/summary-rmuc-blue.png) ## Quick start -Use CMake 3.21+, a C++17 compiler, Qt 6 and Protobuf. Add FFmpeg development libraries for video and Paho MQTT C for match telemetry. The Windows build was tested with MinGW x64 and Qt 6.8.3. Ubuntu CI uses the same Qt version. +Follow the [step-by-step user guide (Chinese)](docs/getting-started/user-guide.md) to download the repository, install dependencies, build on Windows or Ubuntu, preview offline, run a simulated match, and connect to official match services. + +GitHub distributes source code, assets, the simulator, and build tools. The prebuilt executable and double-click launchers are distributed separately as part of the team's runtime kit. See the [runtime kit notes](scripts/portable/README.md) if you already have that package. + +## Integration and verification + +Copy `config.example.json` to a local `config.json`. The template uses loopback for the match connection. Use venue-specific settings when connecting to the official system. + +| Feed | Transport | Local configuration | +| --- | --- | --- | +| Match state | MQTT + Protobuf | `competition.mqtt_broker` and `competition.mqtt_port` for 2027, with port `3333` in the template. Match the player seat to the data source. | +| Main video | Fragmented HEVC/H.265 over UDP | Match `network.video_port` and `video.stream_url` to the forwarded feed. The template listens on `3334`. | +| Industrial camera | H.264 over MQTT `CustomByteBlock` | Uses the match MQTT connection and seat. | +| Optional team heavy-state sync | Separate wired team link | `competition.heavy_sync_source`, with default port `3346`. | + +Use the **2026 compatibility profile** for the standalone simulator's baseline. Confirm the MQTT session and match data first, then test the UDP main video and MQTT camera individually. Selected 2027 UI behavior is covered by test fixtures. [Client configuration](docs/getting-started/configuration.md) · [Simulator](sim/README.md) + +Windows verification includes an offline launch, 27 C++/Qt tests and portable-script checks. Ubuntu CI builds the app and runs 27 C++/Qt tests, simulator tests, the QML check and release audits. Formal 2027 field integration is pending. + +## Repository and contributions + +The Qt client lives in `src/`, arena and UI assets in `resources/`, the local simulator in `sim/`, portable launch tools in `scripts/portable/`, tests in `tests/`, and developer documentation in `docs/`. -```sh -cmake -S . -B build/release -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -cmake --build build/release --parallel 4 -ctest --test-dir build/release --output-on-failure -``` +Use Issues for reports and include the profile, seat, OS, reproduction steps, and expected and actual behavior. Propose changes through pull requests from a feature branch or fork for maintainers to merge into `main`. [Contributor guide](CONTRIBUTING.md) · [Documentation index](docs/README.md) -Add SDK locations to `CMAKE_PREFIX_PATH` when needed. The CMake executable uses the compatibility name `RoboMasterClient2025` (`.exe` on Windows). An existing SPR Windows runtime kit launches `SPR2027Client.exe` through its custom-client launcher. +## References and licensing -Copy `config.example.json` to `config.json` to configure a local connection. The [simulator](sim/README.md) remains a standalone 2026-baseline test source. Local tests cover selected 2027 status and UI behavior. Integration with the 2027 field engine and video hardware is pending. +The 2027 implementation references the [communication protocol](https://bbs.robomaster.com/wiki/20204847/1969151), the [RMUC rulebook](https://bbs.robomaster.com/wiki/20204847/1969149) and the [RMUL rulebook](https://bbs.robomaster.com/wiki/20204847/1969150). The arena images derive from the [official 2027 field drawings](https://bbs.robomaster.com/article/1970956). -This repository contains sources, game assets and build scripts. The Windows runtime kit, official installers and venue configuration are managed outside Git. [Configuration](docs/getting-started/configuration.md) · [Documentation](docs/README.md) · [Portable tools](scripts/portable/README.md) +Source code is available under the MIT License. Maps and other media follow their documented licenses. The project is independently maintained and has no affiliation with DJI or RoboMaster. [MIT License](LICENSE) · [Asset and screenshot register](ASSET_LICENSES.md) diff --git a/README.md b/README.md index 5b2bf40..27d0698 100644 --- a/README.md +++ b/README.md @@ -2,50 +2,130 @@ [简体中文](README.md) · [English](README.en.md) -中国石油大学(北京)SPR 战队的 RoboMaster 2027 自定义终端,基于[复旦大学星云 EGA 的 RM26 Custom Client](https://github.com/ClearWei/RM26_Client) 二次开发。C++ 和 Qt 源码采用 [MIT License](LICENSE),素材来源另见[授权清单](ASSET_LICENSES.md)。 +中国石油大学(北京)SPR 战队的 **RoboMaster 2027 自定义客户端**。操作手可以在主图传界面查看比赛与车辆状态,指挥端可以查看双方阵容、战术地图、事件和工业相机。项目基于复旦大学星云 EGA 的 RM26 Custom Client 二次开发。 [上游项目](https://github.com/ClearWei/RM26_Client) -## 当前功能 +[赛项与车位](#赛项与车位) · [运行界面](#运行界面) · [SPR 2027 具体改动](#spr-2027-具体改动) · [快速开始](#快速开始) · [联调与验证](#联调与验证) -- 按 `P` 选择超级对抗赛、联盟赛 3V3 或 1V1,并登录当局红方或蓝方车位。 -- 指挥屏显示对应场地、红蓝阵容、基地与前哨、战场事件及工业相机。按 `M` 打开大地图。 -- `Ctrl+T` 切换操作手主图传与指挥屏。按住 `Tab` 查看全屏战况。完整操作见[快捷键](docs/getting-started/keyboard-shortcuts.md)。 -- 重装状态和动效跟随登录车位所属队伍。数据与可选队内同步见[配置说明](docs/getting-started/configuration.md#重装状态跨终端同步)。 +> **当前状态** +> +> Windows 与 Ubuntu 已完成构建和自动化回归。2027 正式赛事引擎、真实图传与现场网络待联调。下方界面截图来自客户端运行本地测试数据时的实际画面。 -## 官方依据 +![超级对抗赛指挥屏,中央显示场地图,两侧显示阵容,底部显示飞镖、赛中统计和事件](docs/images/readme/command-rmuc.png) -- [2027 高校系列赛通信协议 V1.0.0](https://bbs.robomaster.com/wiki/20204847/1969151)第 2 章定义自定义终端报文和图传接入,§2.2.7、§2.2.10 至 §2.2.12 对应安装事件和车位状态。 -- [2027 超级对抗赛规则](https://bbs.robomaster.com/wiki/20204847/1969149)和[2027 高校联盟赛规则](https://bbs.robomaster.com/wiki/20204847/1969150)用于核对赛项、场地机制及重装状态。超抗重装安装条件见 §5.7.1,联盟赛 3V3 重装血量见 §3.1.1。 -- 地图使用 [RoboMaster 高校赛务发布的 2027 场地图纸](https://bbs.robomaster.com/article/1970956),SPR 制作俯视图。 [地图许可和修改说明](ASSET_LICENSES.md#spr-2027-地图) +## 赛项与车位 -自定义终端应按参赛赛项和当期规则接入。重装安装事件缺少公开约定的队别字段,界面仅显示能够归属本队的形态状态。 +按 `P` 打开设置,先选择赛项,再登录本场分配的红方或蓝方车位。下表列的是客户端设置页开放的登录车位,指挥屏还会展示裁判数据中可见的其他车位。蓝方 ID 对应红方 ID 加 100,例如红方 3 号为 `3`,蓝方 3 号为 `103`。 + +| 赛项 | 配置值 `competition.profile` | 场地 | 本客户端可选车位 | 战况重点 | +| --- | --- | --- | --- | --- | +| 超级对抗赛 | `rmuc2027` | 28 × 15 m | 重装 1、步兵 3 和 4、空中系统 6 | 基地、前哨、双方阵容、控制度与飞镖 | +| 高校联盟赛 3V3 | `rmul3v3` | 12 × 8 m | 重装 1、步兵 3 | 阵容、控制度、剩余血量与场地图 | +| 高校联盟赛 1V1 | `rmul1v1` | 5 × 5 m | 步兵 3 | 双方步兵血量、车辆状态与场地图 | + +[联盟赛 3V3 指挥屏](docs/images/readme/command-rmul-3v3.png) · [联盟赛 1V1 指挥屏](docs/images/readme/command-rmul-1v1.png) + +## 运行界面 + +### 选手端设置 + +`P` 打开或关闭设置。选车后,阵营视角、己方状态和重装特效随登录车位切换。也可以在设置里用数字键选车,再按 `Enter` 确认。例如红方 3 号按 `3`,蓝方 3 号按 `8`。 [完整选车键位](docs/getting-started/keyboard-shortcuts.md#在设置中选车) + +### 战术指挥屏 + +- **顶部比赛栏**显示队名、比分、回合、阶段和倒计时。超抗显示双方基地和前哨血量。有明确领先依据时显示对应信息。 +- **中央区域**默认显示赛项地图,可按 `Ctrl+Y` 切到工业相机主画面。切换后右侧仍可查看地图。 +- **双方阵容**显示车位、血量和已收到的状态。余弹、热量、复活读条、增益等字段随车位和报文可用性显示。 +- **赛中信息区**汇集飞镖、累计伤害、控制度或剩余血量、战场事件,以及当前车位的车况变化。 +- 雷达和视频有各自的接收状态。看到「等待雷达」或「等待图传」时,可以据此检查对应数据源。未收到的数值用 `—` 等待上报提示表示。 + +### 全屏主图传 + +按 `Ctrl+T` 在指挥屏和操作手主图传之间切换。主图传界面共用顶部比赛栏,画面上叠加当前车位状态、小地图及操作提示。打开全屏战况时,客户端暂停键鼠转发,退出战况后恢复操作。 + +下图的背景是测试注入的演示画面,HUD、顶部比赛栏和小地图由实际客户端绘制。 + +![超抗操作手主图传,顶部保留比分和基地前哨信息,画面叠加车况、准星和小地图](docs/images/readme/pilot-rmuc.png) + +### 全屏战况与大地图 + +- **按住 `Tab`**查看全屏战况,松开返回原界面,也可用 `Esc` 收起。超抗集中显示双方阵容和基地前哨信息。联盟赛战况同屏展示场地图及该赛项的数据。 +- **按 `M`**打开或收起大地图。地图按当前赛项与红蓝视角绘制,展示已收到的定位、目标状态和赛项支持的场地信息。操作手可在大地图里用 `A`、`B`、`I` 选择相应标记类型。 + +![蓝方 3 号视角的超抗全屏战况,蓝方重装显示安装成功,红方显示普通卡片](docs/images/readme/summary-rmuc-blue.png) + +### 补给、车位交互与结算 + +主图传界面用 `O`、`I` 打开相应弹丸补给窗口,登录车位后用 `H` 打开当前角色的兑换或专用面板。交互是否开放,以赛项、车位和裁判系统下发状态为准。进入结算后可以用页面关闭按钮或 `Esc` 收起结算。 [各角色操作与完整快捷键](docs/getting-started/keyboard-shortcuts.md) + +| 快捷键 | 功能 | +| --- | --- | +| `P` | 选赛项和登录车位 | +| `Ctrl+T` | 切换主图传与指挥屏 | +| `Ctrl+Y` | 在指挥屏切换地图与工业相机的主视图 | +| 按住 `Tab` | 查看全屏战况 | +| `M` | 打开或收起大地图 | +| 按住 `~` | 查看伤害统计 | +| 按住 `F12` | 查看快捷键提示 | +| `Esc` | 收起战况或结算 | + +## SPR 2027 具体改动 + +| 模块 | SPR 改动 | +| --- | --- | +| 赛项与地图 | 增加超抗、联盟赛 3V3 和 1V1 档位,按赛项选择场地图、车位和战况布局。以官方场图为来源制作俯视图和地形标注,支持红蓝视角切换。 | +| 指挥与操作视图 | 重做比赛栏、红蓝阵容、事件与车况区域,加入地图与工业相机互换布局,全屏主图传共用比赛栏。Tab 全屏战况与大地图均可从比赛界面快捷打开。 | +| 比赛数据适配 | 增加 2027 相关比分、目标状态、雷达位置、车况、计时、事件和重装状态的解析与界面映射。未知或未归属的数据保持待确认。 | +| 重装形态 | 已解锁时显示己方阵营色提示。收到可归属本队的安装确认后播放约一秒的变形动效,头像切换并进入金色状态。默认各终端独立接裁判数据,队内补充同步可单独配置。 | +| 联调与交付 | 整理 Windows 和 Linux 的运行脚本,补充 Windows 缺项依赖检查、离线启动与比赛网络还原入口,增加赛项、分辨率、红蓝换边、快捷键和重装状态回归。 | + +重装安装事件 `Event 16` 在 2027 公开协议 V1.0.0 中未约定队别或车号。超抗三级装配与成功安装都可能出现 600 血量上限,界面仅展示能够归属本队的形态状态。 [状态来源与可选同步](docs/getting-started/configuration.md#重装状态跨终端同步) · [版本变更日志](CHANGELOG.md) ## 快速开始 -手头已有 SPR Windows 运行包时,双击 `02-运行脚本/Windows/8-启动Windows自定义客户端.bat` 即可看离线界面。赛场数据和图传在接入对应赛事链路后显示。 +**从 GitHub 下载后,请按[客户端使用指南](docs/getting-started/user-guide.md)操作。** 指南覆盖依赖安装、Windows 和 Ubuntu 编译、离线预览、模拟比赛及官方赛事接入。 + +GitHub 提供源码、资源、模拟器和构建工具。战队交付包里的预编译程序和双击启动入口随完整运行包提供。已经拿到完整运行包的队员可以查阅[运行包说明](scripts/portable/README.md)。 -从源码构建需要 CMake 3.21+、支持 C++17 的编译器、Qt 6 和 Protobuf。图传和正式赛场数据分别需要 FFmpeg 开发库及 Paho MQTT C。Windows 上 Qt 与依赖库须与编译器 ABI 一致。本次 Windows 构建使用 MinGW x64 和 Qt 6.8.3。Ubuntu CI 同样使用 Qt 6.8.3。 +## 联调与验证 -```sh -cmake -S . -B build/release -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -cmake --build build/release --parallel 4 -ctest --test-dir build/release --output-on-failure -``` +### 数据和图传如何接入 -依赖安装在自定义路径时,配置阶段用 `CMAKE_PREFIX_PATH` 提供 SDK 前缀。Windows 运行时需要能找到对应 Qt 插件和 DLL。构建产物使用兼容文件名 `RoboMasterClient2025`(Windows 为 `.exe`)。运行包的 Windows 入口为 `SPR2027Client.exe`。详见[开发指南](docs/rm26-client-dev-guide.md)与[运行包说明](scripts/portable/README.md)。 +复制 `config.example.json` 为本机 `config.json`,按本次环境配置。示例默认连接本机回环。现场配置、账号、局域网地址和运行日志保存在本机。 -默认示例配置使用回环网络。联调前复制 `config.example.json` 为 `config.json`,再按现场拓扑填写。本仓库附带[独立模拟器](sim/README.md),可用来检查协议和图传链路。模拟器沿用 2026 基线,2027 部分状态由本地测试报文验证。 +| 数据 | 连接方式 | 要对齐的配置 | +| --- | --- | --- | +| 裁判比赛数据与支持的操作指令 | MQTT + Protobuf | 2027 档使用 `competition.mqtt_broker` 和 `competition.mqtt_port`,模板端口为 `3333`。客户端、选手端和数据源须对应同一车位。 | +| 主图传 | UDP 分片传输 HEVC/H.265 | `network.video_port` 与 `video.stream_url` 要和转发目标匹配,模板监听 `3334`。 | +| 工业相机 | MQTT `CustomByteBlock` 携带 H.264 数据 | 使用比赛数据对应的 Broker 和车位,和主图传是两条链路。 | +| 可选队内重装状态同步 | 单独的队内有线链路 | 按需填写 `competition.heavy_sync_source`,默认端口 `3346`。 | -## 目录与联调状态 +只看界面时可以直接启动客户端。想验证本地消息与图传链路时,从客户端设置选 **2026 兼容档**,和仓库模拟器沿用的 2026 基线对齐。先验证 MQTT 比赛状态,再接主图传和工业相机。2027 的部分状态和界面由自动化测试报文覆盖。 [配置说明](docs/getting-started/configuration.md) · [模拟器启动及推流说明](sim/README.md) -| 目录 | 内容 | +### 当前验证范围 + +| 环境 | 已验证内容 | | --- | --- | -| `src/` | Qt 客户端、协议消息和界面 | -| `resources/` | 界面、地图和音频资源 | -| `sim/` | 独立模拟器 | -| `scripts/portable/` | Windows、Linux 启动和打包工具 | -| `tests/`、`tools/release/` | 回归测试和发行检查 | -| `docs/` | 配置、快捷键、架构和协议说明 | +| Windows / MinGW x64 / Qt 6.8.3 | 源码构建、离线启动、27 项 C++/Qt 回归、便携脚本及依赖检测 | +| Ubuntu / Qt 6.8.3 | GitHub Actions 原生构建、27 项 C++/Qt 回归、模拟器测试、QML 和公开发布预检 | +| 2027 正式赛场 | 正式赛事引擎、真实图传、赛场网络及角色交互待联调 | + +[查看 GitHub Actions 验证记录](https://github.com/SPR-Algorithm/SPR_Client_27/actions/workflows/quality.yml) + +## 目录与贡献 + +| 路径 | 内容 | +| --- | --- | +| `src/` | Qt 客户端、协议解析、车位状态与 QML 界面 | +| `resources/` | 场图、界面资源和音效 | +| `sim/` | 独立模拟器与 Web 控制台 | +| `scripts/portable/` | Windows、Linux 启动及打包工具 | +| `tests/`、`tools/release/` | 自动化回归与发布检查 | +| `docs/` | 安装配置、快捷键、协议依据和架构说明 | + +通过 Issue 报告问题时,附上赛项、车位、系统、复现步骤、期望与实际表现。修改从自己的分支或 fork 发起 Pull Request,由维护者审核后合并到 `main`。 [贡献指南](CONTRIBUTING.md) · [文档索引](docs/README.md) + +## 官方依据与许可 -Windows 构建与红蓝车位切换已通过本地测试。2027 正式赛事引擎、相机图传和赛场网络待现场联调。规则及协议版本见[官方资料索引](docs/references/official-materials.md)。本仓库用于源码开发,已有便携运行包、官方安装程序和现场配置按本地交付目录管理。 +2027 自定义终端报文与图传参考通信协议 V1.0.0 第 2 章。重装事件和车位数据见 §2.2.7、§2.2.10 至 §2.2.12。超抗重装安装见规则 §5.7.1,联盟赛 3V3 重装血量见 §3.1.1。 [通信协议](https://bbs.robomaster.com/wiki/20204847/1969151) · [超抗规则](https://bbs.robomaster.com/wiki/20204847/1969149) · [高校联盟赛规则](https://bbs.robomaster.com/wiki/20204847/1969150) · [官方资料索引](docs/references/official-materials.md) -项目与 DJI 或 RoboMaster 无隶属关系。问题和改动可通过本仓库 Issue 或 Pull Request 提交。 [贡献指南](CONTRIBUTING.md) · [文档索引](docs/README.md) +源代码使用 MIT 许可证,地图和其他素材按各自来源与许可使用。项目由参赛队伍维护,与 DJI 或 RoboMaster 无隶属关系。 [MIT License](LICENSE) · [官方场地图纸](https://bbs.robomaster.com/article/1970956) · [素材与截图许可](ASSET_LICENSES.md) diff --git a/docs/README.md b/docs/README.md index 55eda90..b9abc83 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,7 +12,7 @@ | 你的目标 | 从这里开始 | 下一步 | | --- | --- | --- | | 我想先看它解决什么问题 | [项目 README](../README.md) | 核心能力、系统图和已知限制 | -| 我想在本地跑起来 | [快速开始](../README.md#快速开始) | [配置说明](getting-started/configuration.md)与[模拟器说明](../sim/README.md) | +| 我想在本地跑起来 | [客户端使用指南](getting-started/user-guide.md) | [配置说明](getting-started/configuration.md)与[模拟器说明](../sim/README.md) | | 我要操作客户端 | [客户端快捷键](getting-started/keyboard-shortcuts.md) | 视图切换、选车与操作手面板 | | 我想读懂代码和架构 | [学习路径](learning-path.md) | 架构、线程、协议和测试专题 | | 我想提交一个改动 | [客户端开发指南](rm26-client-dev-guide.md) | [贡献指南](../CONTRIBUTING.md) | diff --git a/docs/getting-started/user-guide.md b/docs/getting-started/user-guide.md new file mode 100644 index 0000000..2fd0d69 --- /dev/null +++ b/docs/getting-started/user-guide.md @@ -0,0 +1,113 @@ +# SPR 客户端使用指南 + +本指南从 GitHub 下载开始,依次完成编译、离线打开、模拟裁判数据和现场接入。以下命令从含有 `CMakeLists.txt` 的仓库根目录执行,除非步骤注明要切换目录。 + +## 1. 获取源码 + +GitHub 的 **Code → Download ZIP** 提供源码压缩包。解压后进入含 `CMakeLists.txt` 的目录。需要后续用 Git 更新时,改用以下命令下载。 + +```bash +git clone https://github.com/SPR-Algorithm/SPR_Client_27.git +cd SPR_Client_27 +``` + +仓库包含源码、地图等资源、模拟器及部分启动和打包工具。源码包没有编译好的 Windows 客户端、战队交付目录里的双击启动脚本、官方赛事引擎或 USB 驱动。手上已经有战队完整运行包的队员可以按[运行包说明](../../scripts/portable/README.md)直接运行。 + +## 2. 安装依赖并编译 + +### Windows x64 + +以下是使用 **MSYS2 MINGW64** 的依赖安装方式。项目已验证的 Windows 环境为 MinGW x64 与 Qt 6.8.3,MSYS2 软件包版本随更新变化。安装后在开始菜单打开 **MSYS2 MINGW64**。如果更新要求关闭终端,重开同一个 MINGW64 终端并再次执行 `pacman -Syu`。 + +1. 安装并更新 [MSYS2](https://www.msys2.org/)。 +2. 在 MINGW64 终端安装编译器、Qt 和协议/视频依赖。 + + ```bash + pacman -Syu + pacman -S --needed git mingw-w64-x86_64-{gcc,cmake,ninja,pkgconf,qt6-base,qt6-declarative,qt6-multimedia,qt6-serialport,qt6-svg,abseil-cpp,protobuf,paho.mqtt.c,ffmpeg} + ``` + +3. 在同一个终端进入源码目录。例如,解压到 `C:\dev\SPR_Client_27` 时执行 `cd /c/dev/SPR_Client_27`。配置、编译并启动。 + + ```bash + cmake -S . -B build/windows -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON -DCMAKE_PREFIX_PATH=C:/msys64/mingw64 -DPAHO_MQTT_ROOT=C:/msys64/mingw64 + cmake --build build/windows --parallel 4 + (cd build/windows && ./RoboMasterClient2025.exe) + ``` + + MSYS2 装在其他位置时,替换两处 `C:/msys64/mingw64`。使用另一套 MinGW SDK 时,Qt、编译器、Protobuf、Abseil、FFmpeg 与 Paho 的架构和 ABI 需一致,运行时将对应的 DLL 目录加入 `PATH`。第一次建议从构建终端启动,让程序继承依赖目录。 + +### Ubuntu 24.04 图形桌面 + +在终端执行以下命令安装系统依赖。Qt 6.8.3 与 CI 一致,从 [Qt 在线安装器](https://www.qt.io/download-qt-installer)选择 **Desktop gcc 64-bit**,并安装 **Qt Multimedia** 和 **Qt Serial Port**。 + +```bash +sudo apt update +sudo apt install -y git build-essential cmake ninja-build pkg-config \ + libgl1-mesa-dev libxcb-cursor0 libxkbcommon-x11-0 libpulse0 libasound2t64 \ + fonts-noto-cjk libabsl-dev libprotobuf-dev protobuf-compiler libpaho-mqtt-dev \ + libavcodec-dev libavformat-dev libavutil-dev libswscale-dev +``` + +进入源码目录后配置、编译并启动。将 `qt_prefix` 改为实际安装前缀,且从有桌面会话的终端启动。 + +```bash +qt_prefix="$HOME/Qt/6.8.3/gcc_64" +cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_PREFIX_PATH="$qt_prefix" +cmake --build build/linux --parallel 4 +(cd build/linux && ./RoboMasterClient2025) +``` + +编译后的程序沿用兼容文件名 `RoboMasterClient2025`。构建会把配置与声音资源复制到程序目录。后续都从该目录启动,以便使用同一份本地配置。配置阶段如提示未找到 Paho MQTT 或 FFmpeg,界面仍可用于离线预览,相关通信或视频功能需要补齐依赖后重新配置和编译。 + +## 3. 离线打开并检查界面 + +1. 按上述系统对应的启动命令打开客户端。初次启动保持示例配置,地址指向本机,无需接赛事路由器。 +2. 按 `P` 打开设置,选择超级对抗赛、联盟赛 3V3 或联盟赛 1V1,再选择对应车位。例如选择超抗后可登录红方 3 号或蓝方 3 号。赛项和车位的对应关系见 [README](../../README.md#赛项与车位)。 +3. 确认指挥屏地图与赛项匹配。按 `Ctrl+T` 切换到主图传界面,检查顶部比赛栏仍可见。按住 `Tab` 查看全屏战况,按 `M` 查看大地图。离线时等待图传、等待雷达和血量显示 `—` 均属预期。 [完整快捷键](keyboard-shortcuts.md) + +到这里已经完成客户端启动。需要看动态数据时,再继续第 4 步。 + +## 4. 在本地接入模拟比赛 + +建议首次在同一台 Ubuntu 主机运行客户端与模拟器,回环地址可直接复用。Windows 可使用 Git Bash,确保 Python 与 Mosquitto 可在该终端调用,按[模拟器说明](../../sim/README.md)准备环境。模拟器沿用 2026 协议基线,请在客户端设置里切换到 **2026 联调**。 + +1. Ubuntu 安装 Python 环境和 Mosquitto,再在源码根目录安装模拟器。 + + ```bash + sudo apt install -y python3 python3-venv mosquitto ffmpeg + python3 -m venv sim/.venv + sim/.venv/bin/python -m pip install -e sim + ``` + +2. 从源码根目录启动模拟器,保持终端运行。 + + ```bash + bash sim/run_sim.sh --no-video --mqtt-host 127.0.0.1 --mqtt-port 3333 --current-robot-id 3 + ``` + +3. 确认客户端程序旁 `config.json` 的 `network.mqtt_broker`、`network.mqtt_port` 和车位分别与模拟器的 `127.0.0.1`、`3333`、红方 3 号一致。启动客户端,在 `P` 中选「2026 联调」与红方 3 号。 +4. 浏览器打开 `http://127.0.0.1:8000`。在「一键赛事演示」点击「一键开始」,确认客户端阶段、倒计时、血量或赛事事件随模拟器变化。 +5. 测试主图传时,保持协议服务运行,另开终端从源码根目录执行下方命令。把路径换成可播放的视频文件,保留客户端监听 UDP `3334`,用 `Ctrl+T` 查看主图传。测试工业相机时,在 Web 控制台的工业相机区域选择视频并开始推流,用指挥屏预览或 `Ctrl+Y` 查看。 + + ```bash + bash sim/run_sim.sh --video-only --video-file /path/to/demo.mp4 --target-ip 127.0.0.1 + ``` + +## 5. 切换到官方赛事环境 + +1. 在客户端设备上保留已验证可运行的构建。按本场赛项从官方渠道准备赛事引擎与官方选手端,并按对应说明安装官方图传驱动。在官方选手端登录本场车位,先验证官方软件有比赛数据和主图传。 [官方资料索引](../references/official-materials.md) +2. 用有线网络按现场分配设置本机地址及掩码。记录原有网卡配置以便恢复。接入前以当场官方说明确认 Broker 地址、端口和主图传目标。 +3. 退出 SPR 客户端,编辑可执行文件旁的 `config.json`。缺少文件时从仓库的 `config.example.json` 复制。2027 档填写 `competition.profile`、`competition.mqtt_broker` 和 `competition.mqtt_port`。主图传端口同时写入 `network.video_port` 和 `video.stream_url`,模板为 `udp://0.0.0.0:3334`。工业相机复用赛事 MQTT,前提是该车位有对应数据源。 [配置说明](configuration.md) +4. 按第 2 步的启动方式重新打开。在 `P` 中选择同一赛项和车位,先确认比赛阶段与计时和官方端一致,再按 `Ctrl+T` 确认主图传。需要工业相机时单独核对该画面。 +5. 联调结束后关闭客户端,恢复联调前的网卡设置。2027 正式赛场环境仍待实机验证,联调记录建议包含赛项、车位、软件版本和通过的链路。 + +## 常见问题 + +| 表现 | 检查顺序 | +| --- | --- | +| CMake 找不到 Qt、Protobuf 或 Abseil | 检查 SDK 路径与所选编译器;若换过工具链,用新的 `build/` 子目录重新配置。 | +| Windows 启动时提示缺 DLL 或 Qt platform plugin | 先从安装依赖的 MINGW64 终端启动,核对 Qt 和其他 DLL 是否来自同一套环境。 | +| 程序能打开但没有比赛数据 | 先查 CMake 是否启用 MQTT,再核对当前协议档位、Broker 地址、端口和车位。 | +| 有比赛数据但主图传黑屏 | 先确认视频源已出图,核对发送目的 IP、UDP 端口、客户端防火墙与 FFmpeg 解码支持。 | +| 主图传正常但工业相机等待 | 检查是否有对应车位的 MQTT `CustomByteBlock` 视频源。 | diff --git a/docs/images/readme/command-rmuc.png b/docs/images/readme/command-rmuc.png new file mode 100644 index 0000000..53c1e65 Binary files /dev/null and b/docs/images/readme/command-rmuc.png differ diff --git a/docs/images/readme/command-rmul-1v1.png b/docs/images/readme/command-rmul-1v1.png new file mode 100644 index 0000000..13b99c1 Binary files /dev/null and b/docs/images/readme/command-rmul-1v1.png differ diff --git a/docs/images/readme/command-rmul-3v3.png b/docs/images/readme/command-rmul-3v3.png new file mode 100644 index 0000000..097f419 Binary files /dev/null and b/docs/images/readme/command-rmul-3v3.png differ diff --git a/docs/images/readme/pilot-rmuc.png b/docs/images/readme/pilot-rmuc.png new file mode 100644 index 0000000..f077367 Binary files /dev/null and b/docs/images/readme/pilot-rmuc.png differ diff --git a/docs/images/readme/summary-rmuc-blue.png b/docs/images/readme/summary-rmuc-blue.png new file mode 100644 index 0000000..c5e66ae Binary files /dev/null and b/docs/images/readme/summary-rmuc-blue.png differ diff --git a/scripts/portable/README.md b/scripts/portable/README.md index 99976a1..2674282 100644 --- a/scripts/portable/README.md +++ b/scripts/portable/README.md @@ -1,9 +1,11 @@ # SPR 运行包与脚本 -本目录保存 Windows 和 Linux 的启动及打包工具。单独克隆源码可直接按[快速开始](../../README.md#快速开始)编译。完整联调用的官方选手端、引擎和驱动应从官方渠道取得。 +本目录保存 Windows 和 Linux 的启动及打包工具。从 GitHub 下载源码后,按[客户端使用指南](../../docs/getting-started/user-guide.md)安装依赖、构建并启动。完整联调用的官方选手端、引擎和驱动应从官方渠道取得。 ## 现有本地运行包 +以下入口随战队完整运行包交付。 + - Windows 自定义客户端从 `02-运行脚本/Windows/8-启动Windows自定义客户端.bat` 打开,可离线查看界面。 - 首次运行官方选手端时执行 Windows 依赖检查,缺项按官方随包说明安装。比赛地址设置与启动程序各有独立入口。 - 联调结束时用 Windows 的还原脚本恢复此前保存的网卡配置。按现场网络填写本地配置,保留正常上网使用的默认路由。 diff --git a/tools/release/public_assets.json b/tools/release/public_assets.json index 52d3f2e..3386862 100644 --- a/tools/release/public_assets.json +++ b/tools/release/public_assets.json @@ -66,6 +66,15 @@ "file_count": 1, "sha256": "eb5f13d8e8060639ace9887ad71798a5855f52a5204bcd2cd01c4470f0e53cb9" } + }, + { + "path": "docs/images/readme", + "status": "approved", + "evidence": "ASSET_LICENSES.md", + "snapshot": { + "file_count": 5, + "sha256": "aad548ce34d4c0fb2a7552913d88a0727d1354b47c4c9481a6d0ad6f2c766e5d" + } } ] }