MohamadA12-programmer/Deep-RL-Drone-Obstacle-Avoidance-Navigation-with-D.C.C-Drone-Command-Center-

GitHub: MohamadA12-programmer/Deep-RL-Drone-Obstacle-Avoidance-Navigation-with-D.C.C-Drone-Command-Center-

一个集成深度强化学习避障策略与全栈指挥中心的无人机自主导航仿真系统,覆盖从 RL 策略推理、Spring Boot 后端到 Flutter 跨平台前端的全链路。

Stars: 0 | Forks: 0

# 无人机指挥中心 一个用于**自主无人机指挥与控制**的全栈顶点项目系统:包含 Spring Boot REST/WebSocket 后端、Flutter 桌面/Web/Android 仪表盘,以及一个 Python NavRL + AirSim 飞行桥接程序,可根据操作员指令在复杂的城市场景中控制虚拟四旋翼飞行器飞行。 ## 架构 ``` flowchart LR subgraph Operator["Operator Workstation"] UI["Flutter Dashboard
(desktop / web)"] end subgraph Server["Backend (Docker)"] API["Spring Boot REST API
:8080/api/**"] WS["WebSocket Hub
/ws/telemetry"] DB[("PostgreSQL 16")] API --- DB API --- WS end subgraph Sim["Simulation Host"] Bridge["NavRL Python Bridge
airsim_auto_bridge.py"] AirSim["AirSim / Unreal
:41451"] Bridge <--> AirSim end UI -- "REST + JWT" --> API UI -- "subscribe telemetry" --> WS Bridge -- "login + push telemetry" --> API Bridge -- "telemetry stream" --> WS API -- "command queue (poll)" --> Bridge ``` * **操作员**通过 Flutter UI 下达任务。 * **后端**负责持久化任务、将指令排队,并通过 WebSocket 广播实时遥测数据。 * **桥接程序**以服务账号身份进行身份验证,轮询指令,并使用 NavRL 学习到的避障策略控制 AirSim 无人机。 ## 快速开始 ### 前置条件 | 工具 | 版本 | 用途 | |------|---------|----------| | Docker Desktop | 4.x | 后端 + Postgres | | Flutter SDK | 3.x | 前端 | | Python | 3.10+ | NavRL 桥接 | | AirSim + Unreal | — | 无人机模拟器(仅用于自主飞行演示) | ### 1. 克隆并配置 ``` git clone https://github.com/MohamadA20-hash/Deep-RL-Drone-Obstacle-Avoidance-Navigation-with-D.C.C-Drone-Command-Center-.git drone-command-center cd drone-command-center Copy-Item .env.example .env # 打开 .env 并填入 DB_PASSWORD, JWT_SECRET, BRIDGE_AUTH_PASS ``` ### 2. 启动后端堆栈 ``` .\run-demo.ps1 ``` 该脚本会加载 `.env`,运行 `docker compose up --build`,等待 `/actuator/health` 报告 `UP`,然后打印后续步骤。后端地址为 ,Swagger 地址为 。 ### 3. 运行前端(在新终端中) ``` cd frontend flutter pub get flutter run -d windows ` --dart-define=API_BASE_URL=http://localhost:8080 ` --dart-define=WS_BASE_URL=ws://localhost:8080 ``` #### Android APK(可选 — 手机与笔记本电脑连接同一 Wi-Fi) 将 `192.168.0.105` 替换为你笔记本电脑的局域网 IP(通过 `ipconfig` 查看活动适配器的 IPv4 地址)。 ``` cd frontend flutter build apk --release ` --dart-define=API_BASE_URL=http://192.168.0.105:8080 ` --dart-define=WS_BASE_URL=ws://192.168.0.105:8080 ` --dart-define=FPV_BASE_URL=http://192.168.0.105:8766/fpv ``` 生成的 APK 位于 `frontend/build/app/outputs/flutter-apk/app-release.apk`。将其复制到手机的 Download 文件夹并点击安装(首次需允许“安装未知应用”)。在笔记本电脑上,为后端 + FPV 桥接端口打开 Windows 防火墙: ``` New-NetFirewallRule -DisplayName "DCC Backend 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow New-NetFirewallRule -DisplayName "DCC FPV 8766" -Direction Inbound -Protocol TCP -LocalPort 8766 -Action Allow ``` 笔记本电脑演示和手机演示可以针对同一后端**同时**运行。 ### 4. 运行 AirSim 桥接(在新终端中) 首先启动你的 AirSim/Unreal 场景,然后运行: ``` cd capstone\airsim_testing # 从项目 .env 中获取 env vars $env:BRIDGE_AUTH_PASS = (Select-String -Path ..\..\.env -Pattern '^BRIDGE_AUTH_PASS=' | ForEach-Object { ($_ -split '=',2)[1] }) python airsim_auto_bridge.py ``` ### 5. 停止所有服务 ``` docker compose down # keep DB data docker compose down -v # also wipe DB volume ``` ## 演示脚本(15 分钟) | # | 步骤 | 位置 | 备注 | |---|------|-------|-------| | 1 | 以 `operator` / `Operator@2026!` 登录 | UI | 首次运行时由 `DataSeeder` 预置 | | 4 | 启动 AirSim 场景 | Unreal | 等待模拟器完全加载 | | 5 | `python airsim_auto_bridge.py` | 终端 3 | 以 `navrl_bridge` 身份验证(同样为预置) | | 6 | 打开**周界巡逻演示**任务 | UI → 任务 | 预置的示例任务 | | 7 | 开始任务 | UI | 无人机解锁,进行 360° 扫描、规划并飞行 | | 8 | 观看实时遥测数据 + FPV 视频流 | UI | 验证轨迹和避障效果 | | 9 | 点击 **EMERGENCY LAND(紧急降落)** 然后退出登录 | UI | 安全关闭 | ## 测试 ``` # Backend 单元测试 (62 个测试, 约30秒) cd backend; .\mvnw test # Flutter 静态分析 cd frontend; flutter analyze ``` 每次向 `main` 推送代码或发起 Pull Request 时都会运行 CI —— 参见 [.github/workflows/ci.yml](.github/workflows/ci.yml)。 ## 报告与图表 最终的书面报告及相关支持材料存放在 `report/` 目录下: * `report/DCC report.docx` — 最终的顶点报告 * `report/figures/` — 报告中引用的图表 * `report/uml/` — UML 图 * `report/zap/` — OWASP ZAP 基线扫描输出 ## 仓库结构 ``` drone-command-center/ ├── backend/ Spring Boot 4 / Java 17 REST API │ ├── src/main/java/ Controllers, services, security, JPA │ ├── src/main/resources/ application.properties, Flyway migrations │ ├── Dockerfile Multi-stage build → eclipse-temurin:17-jre │ └── pom.xml ├── frontend/ Flutter dashboard (Windows desktop, web, Android) │ ├── lib/ core/, features/, ui/ │ ├── android/ Android target (APK build) │ ├── windows/ Windows desktop runner │ ├── web/ Flutter web entrypoint │ └── pubspec.yaml ├── capstone/airsim_testing/ Python NavRL + AirSim bridge │ ├── airsim_auto_bridge.py Bridge entrypoint │ ├── navrl_city_planner.py NavRL planner + occupancy mapping │ ├── command_center_bridge.py Backend REST/WS client │ ├── navrl_model/ PPO policy weights and network code │ └── results/ Evaluation runs used in the report ├── report/ Capstone report (docx) + figures, UML, ZAP ├── docker-compose.yml Postgres + backend ├── .env.example Environment template — copy to .env └── run-demo.ps1 One-shot launcher (Windows) ``` ## 常用命令 ``` # Backend 日志 docker compose logs -f backend # 在运行中的 Postgres 容器中打开 psql docker compose exec postgres psql -U postgres -d drone_command_center # 代码更改后重新构建 backend docker compose up -d --build backend # 运行 Backend 单元测试 (host) cd backend; .\mvnw test # 运行 Flutter widget 测试 cd frontend; flutter test ``` ## 安全说明 * `.env` 已被 git 忽略 —— 请勿提交真实密钥。 * `JWT_SECRET` 在每次部署时必须是全新的 base64 密钥;`application.properties` 中的占位符仅用于本地开发。 * `BRIDGE_AUTH_PASS` 是后端与桥接程序之间的共享密钥 —— 如有疑虑请立即轮换。 * Flyway 已被有意禁用(详情请查看 `application.properties`)。演示阶段的 Schema 由 Hibernate 的 `ddl-auto=update` 管理。在生产环境上线前请重新启用 Flyway。 ## 引用与参考 @ARTICLE{NavRL, author={Xu, Zhefan and Han, Xinming and Shen, Haoyu and Jin, Hanyu and Shimada, Kenji}, journal={IEEE Robotics and Automation Letters}, title={NavRL: Learning Safe Flight in Dynamic Environments}, year={2025}, volume={10}, number={4}, pages={3668-3675}, keywords={Navigation;Robots;Collision avoidance;Training;Safety;Vehicle dynamics;Heuristic algorithms;Detectors;Autonomous aerial vehicles;Learning systems;Aerial systems: Perception and autonomy;reinforcement learning;collision avoidance}, doi={10.1109/LRA.2025.3546069}} ## 致谢 我们感谢卡内基梅隆大学的 NavRL 框架作者 Z. Xu、X. Han、H. Shen、H. Jin 和 K. Shimada,其发表的基于 PPO 的导航策略和基于 LiDAR 的速度障碍安全屏障构成了本研究中评估的 AI 层的基础。同时感谢微软研究院提供的 AirSim 模拟器以及用于评估的 Unreal Engine 4 City 环境。
标签:AirSim仿真, Docker, Flutter, JWT认证, LiDAR安全防护, NavRL框架, PostgreSQL, PPO算法, Python, REST API, Spring Boot, WebSockets, 多端UI, 安全防御评估, 实时任务控制, 强化学习导航, 无人机仿真, 无人机应用, 无人机指挥中心, 无人机控制系统, 无后门, 智能控制, 机器人操作系统, 桌面端控制, 测试用例, 深度强化学习, 移动端控制, 自主导航, 虚拟四旋翼飞行器, 请求拦截, 路径规划, 逆向工具, 遥测数据, 避障系统, 飞行仿真