Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
73 changes: 73 additions & 0 deletions .clang-format
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
---
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
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
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.

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)'
26 changes: 13 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ _ext
nano.save
.catkin_workspace

build/
/build/
devel/
dist/
.vscode/
Modules/object_detection_landing/
Modules/object_detection_persistence/
Modules/object_detection_yolov5openvino/
Modules/object_detection_yolov5tensorrt/
Modules/object_detection_circlex/
Modules/perception/object_detection_landing/
Modules/perception/object_detection_persistence/
Modules/perception/object_detection_yolov5openvino/
Modules/perception/object_detection_yolov5tensorrt/
Modules/perception/object_detection_circlex/
Modules/data/
Modules/object_detection_oneshot/
Modules/object_detection/py_nodes/yolov5_tensorrt_server/build/
Modules/common/CMakeLists.txt
Modules/ego_planner_swarm/CMakeLists.txt
Modules/motion_planning/CMakeLists.txt
Modules/simulator_utils/CMakeLists.txt
Modules/FAST_LIO/Log/mat_pre.txt
Modules/perception/object_detection_oneshot/
Modules/perception/object_detection/py_nodes/yolov5_tensorrt_server/build/
Modules/core/common/CMakeLists.txt
Modules/planning/ego_planner_swarm/CMakeLists.txt
Modules/planning/motion_planning/CMakeLists.txt
Modules/perception/simulator_utils/CMakeLists.txt
Modules/perception/FAST_LIO/Log/mat_pre.txt
# pytorch/python/numpy formats
# *.pth
*.pkl
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
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
150 changes: 150 additions & 0 deletions ARCHITECTURE.md
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
```
12 changes: 12 additions & 0 deletions CMakeLists.txt
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()
Loading
Loading