# UpBot **Repository Path**: GGbondla/up-bot ## Basic Information - **Project Name**: UpBot - **Description**: 灵智项目上位机 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-27 - **Last Updated**: 2026-09-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README I'm ready to generate the README.md file now. The code map provides detailed insights into the project structure and functionality. Based on the analysis: **Project Identity:** * **Name:** up-bot (implied by repository name and config references) * **Type:** Desktop application for motor control, diagnostics, and firmware updates via CAN/CANFD. * **Tech Stack:** Electron, Vue 3, Element Plus UI library. * **Language:** Chinese (based on config documentation and UI framework defaults). **Key Features:** 1. **Device Communication:** Supports various CAN adapters (USBCAN, CANFDNET, etc.) via FFI and ZLG's SDK DLLs. 2. **Protocol Engine:** JSON-based configuration for CAN ID schemes, signal decoding (Intel/Motorola), and message definitions. 3. **Digital Twin UI:** A glass-morphism styled dashboard showing real-time motor KPIs (RPM, torque, temperature) with 3D preview support. 4. **Firmware Update:** Complete UDS ISO-TP implementation over CAN/CANFD for firmware flashing (Pre/Post/Main programming phases). 5. **Diagnostics:** Real-time data monitoring, data processing (CSV playback), and alarm/fault management. 6. **Parameter Management:** Table-based view for reading/writing motor configuration parameters. **Configuration:** * All protocol and motor definitions are externalized in `config/`. * `canfd_protocol.json` contains the core message/signal definitions. * `protocols.json` manages available protocol versions. **Architecture Highlights:** * **Electron Main Process:** Manages CAN adapter lifecycle (ZCAN/CX adapters), firmware flashing workers, and system dialogs. * **Renderer Process:** Handles the UI, data visualization, and user interactions. * **IPC Bridge:** `preload.js` exposes secure APIs (`window.can`, `window.flash`, etc.) to the renderer. This project is a specialized industrial tool, likely for use with robotics or automotive systems requiring precise CAN bus control and diagnostic capabilities. I will generate the README.md in Chinese, focusing on features, usage, and configuration details. ```markdown # UP-BOT 电机控制与诊断平台 UP-BOT 是一款基于 Electron + Vue 3 构建的现代化电机控制与诊断应用。它通过 CAN/CANFD 总线与电机驱动器进行通信,支持实时数据监控、参数配置、故障诊断以及基于 UDS 协议的固件烧录。 ## ✨ 主要特性 * **多协议支持**:采用 JSON 配置文件定义通讯协议(Message ID、数据编码、信号映射),易于扩展和适配不同型号的电机。 * **数字孪生界面**:炫酷的深色玻璃拟态(Glassmorphism)仪表盘,实时展示电机 RPM、扭矩、温度等核心参数。 * **多硬件适配**:集成 ZLG、周立功等主流 CAN 硬件驱动(USBCAN, CANFDNET, PCIeCAN 等),支持硬件扫描与自动识别。 * **固件烧录 (Flash)**:内置完整的 ISO-TP 传输层和 UDS 服务端,支持预编程、主编程、后编程三阶段流程,实现安全可靠的固件升级。 * **数据回放**:支持 CSV 数据文件导入,在线回放历史总线数据,用于故障复现和分析。 ## 🛠️ 技术栈 * **框架**: [Electron](https://www.electronjs.org/) (跨平台桌面应用基础) * **前端**: [Vue 3](https://vuejs.org/) (Composition API), [Vite](https://vitejs.dev/) (构建工具) * **UI 库**: Element Plus (Vue 3 组件库) * **图表**: ECharts (数据可视化) * **通信**: FFI-napi (调用硬件 DLL), IPC (主进程与渲染进程通信) ## 📂 项目结构 核心目录概览: ``` ├── electron/ # 主进程代码 (硬件交互、固件烧录逻辑) │ ├── can/ # CAN 适配器底层驱动 (ZLG, CX 等 DLL 封装) │ └── flash/ # 固件烧录状态机与 ISO-TP 传输层 ├── config/ # 协议配置目录 (JSON 定义文件) │ ├── canfd_protocol.json # 核心协议报文与信号定义 │ └── protocols.json # 协议版本注册表 ├── src/renderer/ # 渲染进程代码 (UI 界面) │ ├── components/ # Vue 组件 (仪表盘、波形图、参数表等) │ ├── composables/ # 组合式函数 (数据监听、CAN 数据处理) │ └── protocol/ # 协议解码引擎 (Intel/Motorola 编码支持) ``` ## 🚀 快速开始 ### 环境准备 确保已安装 Node.js (建议 v16+)。 ### 安装依赖 ```bash npm install ``` ### 启动开发模式 ```bash npm run dev ``` ### 构建生产版本 ```bash npm run build ``` ## 🧩 配置说明 (Protocol Config) 本项目的所有通信协议均与代码分离,存放在 `config/` 目录下。如需适配新电机或修改报文格式,请参考以下说明。 ### 1. 注册新协议 (`protocols.json`) 在 `config/protocols.json` 中添加协议条目: ```json { "id": "motor_x_v1", "name": "X 系列电机 V1.0", "file": "motor_x_v1.json" } ``` ### 2. 定义协议内容 在对应的 JSON 文件(如 `config/motor_x_v1.json`)中,主要包含以下字段: * **`canIdScheme`**: 定义 CAN ID 的编址方案(标准帧/扩展帧、ID 掩码)。 * **`rxMessages`**: 接收报文列表,定义从电机上报的数据(Signal 字段定义了解码规则)。 * **`txMessages`**: 发送报文列表,定义控制命令。 * **`motors`**: 电机实例定义,关联具体的报文收发 ID。 详细字段规范请查阅 `config/README.md`。 ## 📖 使用指南 1. **连接硬件**:启动应用后,进入"连接配置"页面,选择对应的 CAN 适配器类型(如 USBCAN-2E-U),设置波特率并打开设备。 2. **实时监控**:连接成功后,切换到"实时监控"面板,查看电机状态。 3. **参数调试**:在"参数管理"页面,可读取或修改电机内部寄存器。 4. **固件更新**:切换到"固件烧录"页面,选择 `.hex` 或 `.s19` 固件文件,点击开始烧录。应用会自动执行 UDS 流程。 ## 📄 许可证 本项目仅供学习和研究使用。 ## 🤝 贡献 欢迎提交 Issue 或 Pull Request。 ```