Add vehicle details API and update coordinates
- Add /api/vehicle_details endpoint to query vehicle list - Update coordinates to Qingdao area (36.367216, 120.082999) - Set longitude to 0 in vehicle status response Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
096f3398c5
commit
8ff3cbb096
35
server.py
35
server.py
@ -34,8 +34,8 @@ def build_vehicle_status(vehicle_id: str) -> dict:
|
||||
},
|
||||
"motionStatus": {
|
||||
"position": {
|
||||
"latitude": 142.2157,
|
||||
"longitude": 148.92,
|
||||
"latitude": 36.367216,
|
||||
"longitude": 0,
|
||||
},
|
||||
"velocity": {
|
||||
"speed": 0,
|
||||
@ -257,14 +257,14 @@ def build_vehicle_position_info(vehicle_id: str) -> dict:
|
||||
"report_at": now_s(),
|
||||
"action": 0,
|
||||
"z": 0,
|
||||
"x": 6.12613 + random.uniform(-0.5, 0.5),
|
||||
"y": 101.70456 + random.uniform(-0.5, 0.5),
|
||||
"x": 36.367216 + random.uniform(-0.001, 0.001),
|
||||
"y": 120.082999 + random.uniform(-0.001, 0.001),
|
||||
"direction": 1,
|
||||
"v": 0,
|
||||
"theta": -1.5224342,
|
||||
"trailer": {
|
||||
"x": 3.555143,
|
||||
"y": 111.36841,
|
||||
"x": 36.367216,
|
||||
"y": 120.082999,
|
||||
"theta": 100000,
|
||||
},
|
||||
}
|
||||
@ -277,11 +277,11 @@ def build_navi_short_path_report(vehicle_id: str) -> dict:
|
||||
"destinationType": 0,
|
||||
"shortNavi": False,
|
||||
"path": [
|
||||
{"x": 6.126130111981183, "y": 101.70455933734775, "theta": -1.5224548170138026},
|
||||
{"x": 6.138059945020359, "y": 101.45796921849251, "theta": -1.5224956618374788},
|
||||
{"x": 6.149855710682459, "y": 101.2139437738806, "theta": -1.5240533769087043},
|
||||
{"x": 6.161292306904215, "y": 100.96945202164352, "theta": -1.5256081246300013},
|
||||
{"x": 6.172369011037517, "y": 100.72449508309364, "theta": -1.5239545312967973},
|
||||
{"x": 36.367216, "y": 120.082999, "theta": -1.5224548170138026},
|
||||
{"x": 36.368216, "y": 120.083999, "theta": -1.5224956618374788},
|
||||
{"x": 36.369216, "y": 120.084999, "theta": -1.5240533769087043},
|
||||
{"x": 36.370216, "y": 120.085999, "theta": -1.5256081246300013},
|
||||
{"x": 36.371216, "y": 120.086999, "theta": -1.5239545312967973},
|
||||
],
|
||||
"messageName": "NaviShortPathReport",
|
||||
}
|
||||
@ -306,6 +306,18 @@ async def handle_vehicle_status(request: web.Request) -> web.Response:
|
||||
return web.json_response(build_vehicle_status(vehicle_id))
|
||||
|
||||
|
||||
async def handle_vehicle_details(request: web.Request) -> web.Response:
|
||||
return web.json_response({
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": [
|
||||
"AET02",
|
||||
"AET01"
|
||||
],
|
||||
"timestamp": now_ms()
|
||||
})
|
||||
|
||||
|
||||
async def ws_at_manager(request: web.Request) -> web.WebSocketResponse:
|
||||
vehicle_id = request.query.get("vehicleId") or "AET01"
|
||||
ws = web.WebSocketResponse()
|
||||
@ -381,6 +393,7 @@ async def ws_at_manager_path(request: web.Request) -> web.WebSocketResponse:
|
||||
def create_app() -> web.Application:
|
||||
app = web.Application()
|
||||
app.router.add_post("/api/vehicle_manager/v1/vehicles/{vehicleId}/status", handle_vehicle_status)
|
||||
app.router.add_get("/api/vehicle_details", handle_vehicle_details)
|
||||
app.router.add_get("/ws/at_manager", ws_at_manager)
|
||||
app.router.add_get("/ws/at_manager_bsm", ws_at_manager_bsm)
|
||||
app.router.add_get("/ws/at_manager_path", ws_at_manager_path)
|
||||
|
||||
28
接口文档3.md
Normal file
28
接口文档3.md
Normal file
@ -0,0 +1,28 @@
|
||||
车辆管理系统接口文档
|
||||
1. 查询车辆列表
|
||||
接口描述
|
||||
该接口用于查询项目车辆列表数据。
|
||||
|
||||
接口详情
|
||||
协议名称: HTTP
|
||||
|
||||
接口地址: /api/vehicle_details
|
||||
|
||||
请求方法: GET
|
||||
|
||||
请求参数: 无
|
||||
参数名称,参数类型,描述
|
||||
code,int,状态码
|
||||
msg,str,任务信息
|
||||
data,str,车辆列表
|
||||
timestamp,float,时间戳
|
||||
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": [
|
||||
"AET02",
|
||||
"AET01"
|
||||
],
|
||||
"timestamp": 0
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user