CollisionAvoidance/README.md

187 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 机场地面交通管制系统
这是一个用于机场地面交通管制的碰撞避障系统使用C++17开发。
## 依赖项
- CMake 3.15+
- C++17 编译器
- Boost
- nlohmann_json
- Python 3.x (用于模拟数据服务器)
- Flask (Python包用于模拟数据服务器)
## 安装依赖
### 1. 安装系统依赖
```bash
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libboost-all-dev \
nlohmann-json3-dev \
python3 \
python3-pip
# CentOS/RHEL
sudo yum install -y \
gcc-c++ \
cmake \
boost-devel \
nlohmann-json-devel \
python3 \
python3-pip
```
### 2. 安装Python依赖
```bash
pip3 install flask
```
### 3. MacOS
```bash
brew install cmake
brew install boost
brew install nlohmann-json
# 安装 Python如果需要
brew install python3
# 安装 Flask用于模拟服务器
pip3 install flask
# 检查版本
cmake --version
brew list boost
brew list nlohmann-json
python3 --version
pip3 list | grep Flask
```
## 构建和运行
### 1. 启动模拟数据服务器
```bash
# 在项目根目录下
cd tools
python3 mock_server.py
```
模拟服务器将在 <http://localhost:8080/api/vehicles> 提供飞行器和车辆的位置数据。
### 2. 构建项目
```bash
# 在项目根目录下
mkdir build
cd build
cmake ..
make -j4
```
### 3. 运行程序
```bash
# 在build目录下
./airport_collision_avoidance
```
## 数据格式
模拟服务器提供的数据格式示例:
```json
{
"vehicles": [
{
"id": "AIRCRAFT_1",
"type": "AIRCRAFT",
"position": {
"x": 1000.0,
"y": 1000.0
},
"velocity": {
"x": 5.0,
"y": 3.0
},
"heading": 45.0,
"timestamp": 1234567890,
"altitude": 500.0
},
{
"id": "VEHICLE_1",
"type": "VEHICLE",
"position": {
"x": 500.0,
"y": 500.0
},
"velocity": {
"x": 2.0,
"y": 1.0
},
"heading": 90.0,
"timestamp": 1234567890,
"altitude": 0.0
}
]
}
```
## 项目结构
```mermaid
graph TD
A[项目根目录] --> B[CMakeLists.txt]
A --> C[README.md]
A --> D[src/]
D --> E[main.cpp]
D --> F[core/]
D --> G[collector/]
D --> H[detector/]
D --> I[command/]
D --> J[network/]
D --> K[types/]
K --> L[concurrent/]
A --> M[tools/]
M --> N[mock_server.py]
```
## 开发说明
1. 模拟服务器每秒更新一次数据
2. 系统每100ms获取一次数据
3. 支持飞行器和地面车辆两种类型
4. 实时显示位置、速度、航向等信息
## 故障排除
1. 如果无法连接到模拟服务器,请检查:
- 模拟服务器是否正在运行
- 端口8080是否被占用
- 防火墙设置
2. 如果编译失败,请检查:
- 是否安装了所有依赖
- CMake版本是否满足要求
- 编译器是否支持C++17
## 注意事项
1. 模拟服务器仅用于开发和测试
2. 生产环境请使用实际的数据源
3. 默认配置适用于本地开发环境
## 许可证
[添加许可证信息]
## 联系方式
[添加联系方式]