Control API
Section titled “Control API”控制 API 用于实时控制 USV 的运动和行为。
移动到指定位置
Section titled “移动到指定位置”POST /api/v1/control/move请求体:
{ "device_id": "USV-2024-001", "latitude": 31.2354, "longitude": 121.4787, "speed": 5, "heading": 90}响应:
{ "success": true, "data": { "command_id": "cmd-001", "status": "executing", "eta": 180 }}POST /api/v1/control/stop请求体:
{ "device_id": "USV-2024-001", "mode": "immediate"}POST /api/v1/control/return请求体:
{ "device_id": "USV-2024-001", "speed": 8}设置速度和方向
Section titled “设置速度和方向”POST /api/v1/control/manual请求体:
{ "device_id": "USV-2024-001", "throttle": 0.7, "rudder": 0.3}参数说明:
throttle: 油门 (-1.0 到 1.0)rudder: 舵角 (-1.0 到 1.0)
切换导航模式
Section titled “切换导航模式”POST /api/v1/control/mode请求体:
{ "device_id": "USV-2024-001", "mode": "auto"}支持的模式:
auto- 自动导航manual- 手动控制waypoint- 航点导航hold- 保持位置
Python SDK 示例
Section titled “Python SDK 示例”from jhusv import Client
client = Client(api_key='your-api-key')
# 移动到指定位置client.control.move_to( device_id='USV-2024-001', latitude=31.2354, longitude=121.4787, speed=5)
# 停止client.control.stop('USV-2024-001')
# 返回client.control.return_home('USV-2024-001')查看更多示例请访问 API 概览。