文档
测试
导航

01-下发任务

POST
/api/task/set

接口描述

执行临时任务

请求头

参数名
类型
描述
必填
authorization
string
token
必填
Content-Type
string
application/json
必填

请求参数

参数名
类型
描述
必填
name
string
任务名称,示例:task1
必填
mode
int
任务模式,0:即时任务,1:定时任务,2:每周定时任务,3:每月定时任务
必填
loop
int
任务循环次数,示例:10
必填
minute
null 或 array[int]
任务执行时间,即时任务填null,其他填写array[int],示例:null
必填
hour
null 或 array[int]
任务执行时间,即时任务填null,其他填写array[int],示例:null
必填
opt
null 或 array[int]
任务选项,即时任务、定时任务填null,每周、每月填写array[int],示例:null
必填
actions
array
动作列表
必填
type
int
动作类型,1:自由点,2:充电,3:轨迹,4:等待动作,5:拓扑站点,6:IO动作
必填
value
object
动作数据
必填

任务参数示例

### 任务类型(mode类型) - 0:即时任务 示例:`{"name":"task1","mode":0,"loop":10,"minute":null,"hour":null,"opt":null,"actions":[{"type":5,"value":["1","2","3"]}]}` - 1:定时任务 示例:`{"name":"task1","mode":1,"loop":10,"minute":[35],"hour":[16],"opt":null,"actions":[{"type":5,"value":["1","2","3"]}]}` - 2:每周定时任务(周天为0, 周一为1,...,周六为6) 示例:`{"name":"task1","mode":2,"loop":10,"minute":[35],"hour":[16],"opt":[0,1,2,5,6],"actions":[{"type":5,"value":["1","2","3"]}]}` - 3:每月定时任务(1-31代表每月的第几天) 示例:`{"name":"task1","mode":3,"loop":10,"minute":[35],"hour":[16],"opt":[1,2,3,31],"actions":[{"type":5,"value":["1","2","3"]}]}` ### 动作类型(actions动作列表) - 1:自由点 type动作类型,value自由点列表(`[{"点1":[x1, y1, theta1]}, {"点2":[x2, y2, theta2]}, ...]`, 其中x、y为点在地图中坐标,单位m,theta为朝向,单位rad) 示例:`{"type":1,"value":[{"1":[1.2464645247251578,4.9575624326841705,-0.3868831688666099]},{"2":[2.2172648606322336,1.2749412076809263,-0.3383879987119119]}]}` - 2:充电 type动作类型,value为是否回充(true:回充) 示例:` { "type": 2,"value": true}` - 3:轨迹 type动作类型,value表示轨迹信息(`{"reverse": false, "name": "1", points: [[x1, y1, theta1], [x2, y2, theta2]]}`,其中reverse代表是否逆序,name为名称,points为点位列表) 示例:` {"type": 3, "value": {"reverse": false, "name": "1", points:[[1.2464645247251578,4.9575624326841705,-0.3868831688666099], 2.2172648606322336,1.2749412076809263,-0.3383879987119119]]}}` - 4:等待动作 type动作类型,value等待信息(`{"time": 10, "angular": 0}`,time等待时长,单位s,angular旋转速度,单位rad) 示例:` {"type": 4, "value": {"time": 10, "angular": 0}}` - 5:拓扑站点 type动作类型,value站点名称列表 示例:` {"type": 5, "value": ["1", "2", "3"]}` - 6:IO动作 type动作类型,value表示IO动作序号(从1开始) 示例:` { "type": 6,"value": 1}`

响应参数

参数名
类型
描述
必填
code
int
返回状态,0:成功,非0:失败
必填
data
object
必填
msg
string
错误信息
必填