-
Notifications
You must be signed in to change notification settings - Fork 456
refactor: 深度重构仓库框架 - 按功能域分组模块、统一构建系统、添加CI #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
5
commits into
main
Choose a base branch
from
devin/1775189555-deep-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eb39317
refactor: reorganize repository structure by functional domain
devin-ai-integration[bot] 82b39a2
ci: make clang-format check advisory (continue-on-error)
devin-ai-integration[bot] 96f1d07
fix: add swarm to Makefile 'all' target and comment out missing objec…
devin-ai-integration[bot] f65b43b
fix: update relative include paths in CMakeLists.txt for new director…
devin-ai-integration[bot] 1fa2c2b
ci: use ubuntu-22.04 runner for better queue availability
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| # Prometheus C/C++ Code Style | ||
| # Based on Google style with adjustments for ROS conventions | ||
| Language: Cpp | ||
| BasedOnStyle: Google | ||
| AccessModifierOffset: -4 | ||
| AlignAfterOpenBracket: Align | ||
| AlignConsecutiveAssignments: false | ||
| AlignConsecutiveDeclarations: false | ||
| AlignOperands: true | ||
| AlignTrailingComments: true | ||
| AllowAllParametersOfDeclarationOnNextLine: true | ||
| AllowShortBlocksOnASingleLine: false | ||
| AllowShortCaseLabelsOnASingleLine: false | ||
| AllowShortFunctionsOnASingleLine: Inline | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortLoopsOnASingleLine: false | ||
| AlwaysBreakAfterReturnType: None | ||
| AlwaysBreakBeforeMultilineStrings: true | ||
| AlwaysBreakTemplateDeclarations: Yes | ||
| BinPackArguments: true | ||
| BinPackParameters: true | ||
| BraceWrapping: | ||
| AfterClass: false | ||
| AfterControlStatement: false | ||
| AfterEnum: false | ||
| AfterFunction: true | ||
| AfterNamespace: false | ||
| AfterStruct: false | ||
| AfterUnion: false | ||
| BeforeCatch: false | ||
| BeforeElse: false | ||
| IndentBraces: false | ||
| BreakBeforeBinaryOperators: None | ||
| BreakBeforeBraces: Custom | ||
| BreakBeforeTernaryOperators: true | ||
| BreakConstructorInitializersBeforeComma: false | ||
| ColumnLimit: 120 | ||
| CommentPragmas: '^ IWYU pragma:' | ||
| ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
| ConstructorInitializerIndentWidth: 4 | ||
| ContinuationIndentWidth: 4 | ||
| Cpp11BracedListStyle: true | ||
| DerivePointerAlignment: false | ||
| DisableFormat: false | ||
| ExperimentalAutoDetectBinPacking: false | ||
| FixNamespaceComments: true | ||
| IncludeBlocks: Preserve | ||
| IndentCaseLabels: true | ||
| IndentWidth: 4 | ||
| IndentWrappedFunctionNames: false | ||
| KeepEmptyLinesAtTheStartOfBlocks: false | ||
| MaxEmptyLinesToKeep: 1 | ||
| NamespaceIndentation: None | ||
| PointerAlignment: Left | ||
| ReflowComments: true | ||
| SortIncludes: true | ||
| SortUsingDeclarations: true | ||
| SpaceAfterCStyleCast: false | ||
| SpaceAfterTemplateKeyword: true | ||
| SpaceBeforeAssignmentOperators: true | ||
| SpaceBeforeParens: ControlStatements | ||
| SpaceInEmptyParentheses: false | ||
| SpacesBeforeTrailingComments: 2 | ||
| SpacesInAngles: false | ||
| SpacesInCStyleCastParentheses: false | ||
| SpacesInContainerLiterals: true | ||
| SpacesInParentheses: false | ||
| SpacesInSquareBrackets: false | ||
| Standard: Cpp11 | ||
| TabWidth: 4 | ||
| UseTab: Never | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Prometheus CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build-core: | ||
| name: Build Core Modules | ||
| runs-on: ubuntu-22.04 | ||
| container: | ||
| image: ros:noetic-ros-base-focal | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y \ | ||
| python3-catkin-tools \ | ||
| ros-noetic-mavros-msgs \ | ||
| ros-noetic-mavlink \ | ||
| ros-noetic-tf2-ros \ | ||
| ros-noetic-tf2-eigen \ | ||
| ros-noetic-pcl-ros \ | ||
| ros-noetic-cv-bridge \ | ||
| ros-noetic-image-transport \ | ||
| libeigen3-dev \ | ||
| libpcl-dev \ | ||
| libopencv-dev \ | ||
| libboost-all-dev | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| - name: Build common (core messages) | ||
| run: | | ||
| source /opt/ros/noetic/setup.bash | ||
| catkin_make --source Modules/core/common --build build/common | ||
| - name: Build communication | ||
| run: | | ||
| source /opt/ros/noetic/setup.bash | ||
| source devel/setup.bash || true | ||
| catkin_make --source Modules/communication --build build/communication | ||
| - name: Build UAV control | ||
| run: | | ||
| source /opt/ros/noetic/setup.bash | ||
| source devel/setup.bash || true | ||
| catkin_make --source Modules/control/uav_control --build build/uav_control | ||
|
|
||
| clang-format-check: | ||
| name: Code Style Check | ||
| runs-on: ubuntu-latest | ||
| # Advisory only — existing code is not yet reformatted. | ||
| # This check will report style violations but won't block merges. | ||
| continue-on-error: true | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Check C++ code style | ||
| uses: jidicula/clang-format-action@v4.13.0 | ||
| with: | ||
| clang-format-version: '14' | ||
| check-path: 'Modules' | ||
| exclude-regex: '(min_snap_trajectory|FAST_LIO)' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| [submodule "Modules/swarm_control"] | ||
| path = Modules/swarm_control | ||
| path = Modules/swarm/swarm_control | ||
| url = https://gitee.com/amovlab1/swarm_control.git | ||
| [submodule "Modules/matlab_bridge"] | ||
| path = Modules/matlab_bridge | ||
| path = Modules/integration/matlab_bridge | ||
| url = https://gitee.com/amovlab1/matlab_bridge.git | ||
| [submodule "Modules/swarm_formation"] | ||
| path = Modules/swarm_formation | ||
| path = Modules/swarm/swarm_formation | ||
| url = https://gitee.com/amovlab1/Swarm-Formation.git | ||
| [submodule "Modules/searching_pkg"] | ||
| path = Modules/searching_pkg | ||
| path = Modules/swarm/searching_pkg | ||
| url = https://gitee.com/amovlab1/swarm-sch-track.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| # Prometheus 架构文档 | ||
|
|
||
| ## 项目概述 | ||
|
|
||
| Prometheus 是一套基于 ROS1 (catkin) 和 PX4 的自主无人机开源软件平台,提供控制、规划、感知、通信和集群等功能模块。 | ||
|
|
||
| ## 目录结构 | ||
|
|
||
| ``` | ||
| Prometheus/ | ||
| ├── Modules/ # 功能模块(按域分组) | ||
| │ ├── core/ # 核心基础 | ||
| │ │ └── common/ # 公共消息定义 & 工具头文件 | ||
| │ │ ├── prometheus_msgs/ # Prometheus 自定义 ROS 消息/服务 | ||
| │ │ ├── quadrotor_msgs/ # 四旋翼消息定义 | ||
| │ │ └── include/ # 公共头文件 (math_utils, geometry_utils, printf_utils) | ||
| │ ├── control/ # 控制模块 | ||
| │ │ ├── uav_control/ # 无人机控制节点 (PID/UDE/NE 控制器) | ||
| │ │ ├── uav_control_fmt/ # FMT 固件无人机控制 | ||
| │ │ └── ugv_control/ # 无人地面车辆控制 | ||
| │ ├── planning/ # 规划模块 | ||
| │ │ ├── motion_planning/ # 运动规划 (全局/局部/min-snap) | ||
| │ │ ├── ego_planner_swarm/ # EGO-Planner 集群避障规划 | ||
| │ │ └── global_planner_ugv/ # UGV 全局路径规划 | ||
| │ ├── perception/ # 感知模块 | ||
| │ │ ├── FAST_LIO/ # 基于 LiDAR 的实时定位与建图 | ||
| │ │ └── simulator_utils/ # 仿真感知工具 | ||
| │ ├── communication/ # 通信模块 (地面站桥接) | ||
| │ ├── swarm/ # 集群模块 | ||
| │ │ ├── swarm_control/ # 集群控制 (submodule) | ||
| │ │ ├── swarm_formation/ # 集群编队 (submodule) | ||
| │ │ └── searching_pkg/ # 集群搜索与跟踪 (submodule) | ||
| │ ├── demo/ # 示例与实验 | ||
| │ │ ├── tutorial_demo/ # 教程演示 | ||
| │ │ ├── future_aircraft/ # 未来飞行器实验 | ||
| │ │ └── experiment/ # 实验配置与启动文件 | ||
| │ └── integration/ # 外部集成 | ||
| │ └── matlab_bridge/ # MATLAB/Simulink 桥接 (submodule) | ||
| ├── Simulator/ # 仿真环境 | ||
| │ ├── gazebo_simulator/ # Gazebo 仿真 (模型/世界/launch) | ||
| │ ├── airsim_simulator/ # AirSim 仿真 | ||
| │ ├── realsense_gazebo_plugin/ | ||
| │ ├── velodyne_gazebo_plugins/ | ||
| │ └── livox_laser_gazebo_plugins/ | ||
| ├── scripts/ # 脚本 | ||
| │ ├── build/ # 编译脚本 | ||
| │ ├── installation/ # 安装脚本 | ||
| │ └── simulation/ # 仿真启动脚本 | ||
| ├── CMakeLists.txt # 顶层 catkin workspace 配置 | ||
| ├── Makefile # 统一构建入口 | ||
| └── .github/workflows/ # CI/CD 配置 | ||
| ``` | ||
|
|
||
| ## 模块依赖关系 | ||
|
|
||
| ``` | ||
| ┌─────────────────┐ | ||
| │ core/common │ | ||
| │ (prometheus_msgs│ | ||
| │ quadrotor_msgs)│ | ||
| └────────┬────────┘ | ||
| │ | ||
| ┌──────────────┼──────────────┐ | ||
| │ │ │ | ||
| ▼ ▼ ▼ | ||
| ┌────────────┐ ┌─────────────┐ ┌──────────┐ | ||
| │ control/ │ │ planning/ │ │perception│ | ||
| │uav_control │ │motion_plan. │ │ FAST_LIO │ | ||
| │ugv_control │ │ego_planner │ │sim_utils │ | ||
| │uav_ctrl_fmt│ │global_ugv │ └──────────┘ | ||
| └──────┬─────┘ └──────┬──────┘ | ||
| │ │ | ||
| ▼ ▼ | ||
| ┌─────────────┐ ┌──────────┐ | ||
| │communication│ │ swarm/ │ | ||
| │(ground stn) │ │swarm_ctrl│ | ||
| └─────────────┘ │formation │ | ||
| │searching │ | ||
| └──────────┘ | ||
| ``` | ||
|
|
||
| ### 编译顺序 | ||
|
|
||
| 1. **core/common** — 必须最先编译(消息定义) | ||
| 2. **Simulator/** — 仿真插件和模型 | ||
| 3. **control/** — 控制模块 | ||
| 4. **communication/** — 通信模块(依赖 core) | ||
| 5. **planning/** — 规划模块(依赖 core, control) | ||
| 6. **perception/** — 感知模块(依赖 core) | ||
| 7. **swarm/** — 集群模块(依赖 core, control, communication) | ||
| 8. **demo/** — 示例(依赖 core, control) | ||
|
|
||
| ## 构建方式 | ||
|
|
||
| ### 使用 Makefile(推荐) | ||
|
|
||
| ```bash | ||
| make help # 查看所有构建目标 | ||
| make all # 构建全部模块 | ||
| make control # 仅构建控制模块 | ||
| make planning # 仅构建规划模块 | ||
| make clean # 清理构建产物 | ||
| ``` | ||
|
|
||
| ### 使用编译脚本 | ||
|
|
||
| ```bash | ||
| bash scripts/build/compile_all.sh # 编译全部 | ||
| bash scripts/build/compile_control.sh # 编译控制模块 | ||
| bash scripts/build/compile_planning.sh # 编译规划模块 | ||
| ``` | ||
|
|
||
| ## 消息定义 | ||
|
|
||
| 所有自定义 ROS 消息和服务位于 `Modules/core/common/`: | ||
|
|
||
| - **prometheus_msgs**: UAVState, UAVCommand, UAVSetup, SwarmCommand, DetectionInfo 等 | ||
| - **quadrotor_msgs**: PositionCommand, SO3Command 等(用于底层控制) | ||
|
|
||
| ## 代码风格 | ||
|
|
||
| 项目使用 `.clang-format` 定义 C++ 代码风格,基于 Google 风格并适配 ROS 开发习惯: | ||
| - 缩进: 4 空格 | ||
| - 行宽: 120 字符 | ||
| - 指针对齐: 左对齐 (`int* ptr`) | ||
|
|
||
| 格式化代码: | ||
| ```bash | ||
| # 格式化单个文件 | ||
| clang-format -i path/to/file.cpp | ||
|
|
||
| # 格式化整个模块 | ||
| find Modules/control -name "*.cpp" -o -name "*.h" | xargs clang-format -i | ||
| ``` | ||
|
|
||
| ## Git 子模块 | ||
|
|
||
| 以下模块作为 Git 子模块管理(源码托管在 Gitee): | ||
|
|
||
| | 模块 | 路径 | 源仓库 | | ||
| |------|------|--------| | ||
| | swarm_control | Modules/swarm/swarm_control | gitee.com/amovlab1/swarm_control | | ||
| | swarm_formation | Modules/swarm/swarm_formation | gitee.com/amovlab1/Swarm-Formation | | ||
| | searching_pkg | Modules/swarm/searching_pkg | gitee.com/amovlab1/swarm-sch-track | | ||
| | matlab_bridge | Modules/integration/matlab_bridge | gitee.com/amovlab1/matlab_bridge | | ||
|
|
||
| 克隆时初始化子模块: | ||
| ```bash | ||
| git clone --recursive https://github.com/amov-lab/Prometheus.git | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Top-level CMakeLists.txt for Prometheus catkin workspace | ||
| # This file enables `catkin_make` from the project root. | ||
| # | ||
| # Usage: | ||
| # catkin_make # Build all modules | ||
| # catkin_make --only-pkg-with-deps prometheus_uav_control # Build specific package | ||
| # | ||
| # For module-specific builds, use the scripts in scripts/build/ | ||
|
|
||
| cmake_minimum_required(VERSION 2.8.12) | ||
| find_package(catkin REQUIRED) | ||
| catkin_workspace() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.