update readme
This commit is contained in:
parent
0975e88f5a
commit
ce15fcb185
69
README.md
69
README.md
|
|
@ -1,2 +1,69 @@
|
|||
# radar_warning
|
||||
# 雷达预警服务
|
||||
|
||||
提供雷达设置和实时探测预警功能。
|
||||
|
||||
## 启动服务
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
python main.py
|
||||
```
|
||||
|
||||
服务启动后访问:
|
||||
- API:http://localhost:8000
|
||||
- Swagger文档:http://localhost:8000/docs
|
||||
- ReDoc文档:http://localhost:8000/redoc
|
||||
|
||||
## API 接口
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|------|------|------|
|
||||
| POST | `/radar/setup` | 设置雷达(经纬度 + 探测范围) |
|
||||
| GET | `/radar/start` | 启动探测(SSE持续返回) |
|
||||
| POST | `/radar/stop` | 停止雷达 |
|
||||
| GET | `/radar/status` | 查看雷达状态 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 1. 设置雷达
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8000/radar/setup \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"latitude": 39.9042, "longitude": 116.4074, "range_km": 200}'
|
||||
```
|
||||
|
||||
### 2. 启动探测
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/radar/start
|
||||
```
|
||||
|
||||
### 3. 停止探测
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8000/radar/stop
|
||||
```
|
||||
|
||||
## 返回数据示例
|
||||
|
||||
```json
|
||||
{
|
||||
"aircraft": {
|
||||
"latitude": 40.15,
|
||||
"longitude": 116.52,
|
||||
"altitude": 10500,
|
||||
"distance_to_radar_km": 45.2
|
||||
},
|
||||
"alert_status": "alert",
|
||||
"is_in_range": true
|
||||
}
|
||||
```
|
||||
|
||||
## 预警状态
|
||||
|
||||
| 状态 | 说明 |
|
||||
|------|------|
|
||||
| `safe` | 飞机在雷达探测范围外 |
|
||||
| `warning` | 飞机进入探测范围70%-100% |
|
||||
| `alert` | 飞机进入探测范围70%以内(触发报警) |
|
||||
|
|
|
|||
Loading…
Reference in New Issue