跳转至

硬件控制 API

所有端点以 /api/v1/devices/{device_id} 为前缀。硬件控制指令通过 Proxy 转发到设备执行。


GET /api/v1/devices/{device_id}/hardware/position

获取设备各轴的当前位置。

响应

{
  "success": true,
  "status": 200,
  "data": {
    "x": 100.0,
    "y": 150.0,
    "z": 5.0,
    "r": 0.0
  }
}

GET /api/v1/devices/{device_id}/hardware/sync

获取轴同步状态。

响应

{
  "success": true,
  "status": 200,
  "data": { "同步状态" }
}

POST /api/v1/devices/{device_id}/hardware/move

执行运动控制指令。

请求

{
  "x": 120.5,
  "y": 80.0,
  "z": 3.0,
  "r": 45.0,
  "speed": 100,
  "relative": false
}

响应

{
  "success": true,
  "status": 200,
  "data": { "运动结果" }
}

POST /api/v1/devices/{device_id}/hardware/pump

控制真空泵。

请求

{
  "state": true
}
参数 类型 说明
state boolean true 开启,false 关闭

POST /api/v1/devices/{device_id}/hardware/valve

控制气阀。

请求

{
  "state": true
}

POST /api/v1/devices/{device_id}/hardware/light

控制灯光。

请求

{
  "state": true,
  "brightness": 128
}
参数 类型 说明
state boolean true 开启,false 关闭
brightness int(可选) 亮度值 0-255

POST /api/v1/devices/{device_id}/hardware/pick

执行吸取元件操作。

请求

{
  "component_id": "元件标识",
  "x": 100.0,
  "y": 200.0,
  "angle": 0.0
}

响应

{
  "success": true,
  "status": 200,
  "data": { "吸取结果" }
}