一、机构模式脚本文件说明
1.1 脚本文件说明
- 料箱机器人的脚本文件,包含 4个文件
crc.py,
pickingRobot.py,`` ctuTask.py,``ctuNoBlock.py
。其中crc.py
是定义循环冗余校验,pickingRobot.py
定义机器人的模型,ctuTask.py
定义任务模式指令,ctuNoBlock.py
定义机构模式指令。 - 文档说明:下文的指令示例都是基于 3051 API 的格式。如果采用 3066 API 格式,需要增加
task_id
和source_id
字段。
1.2 指令操作说明
operation | 任务指令说明 | 脚本参数 |
---|---|---|
load | 从货架取货放到车身背篓里 | lift rotate stretch visionType visionBinType[可缺省] selfPosition[可缺省] loadHeight[可缺省] |
unload | 从背篓里取货放至货架上 | lift rotate stretch visionType visionBinType[可缺省] selfPosition[可缺省] unloadHeight[可缺省] |
change | 内部货物调换背篓 | changePosition0 changePosition1 |
zero | 料箱车机构标零 | 无 |
getMarkerPos | 获取货架二维码信息 | 无 |
lift | 抓斗抬升 | lift |
rotate | 抓斗旋转 | rotate |
stretch | 手臂伸缩 | stretch |
finger | 手指开合 | finger |
1.3 脚本参数说明
参数 | 数据类型 | 说明 |
---|---|---|
lift | int | 货叉升降高度 |
recBoxLift | int | 识别料箱码高度 |
rotate | int | 货叉旋转角度 rad |
stretch | int | 货叉伸出长度 |
finger | int | 0: close, 1: open |
visionType | complex | 识别对象类型,box or shelf |
visionBinType | complex | 货物识别类型 |
binModel | complex | 料箱种类,当visionBinType为markerless时需要填写这项 |
chassisLedFront | int | 小车前部灯 1: open, 0: close |
chassisLedBack | int | 小车后部灯 1: open, 0: close |
buzzer | int | 蜂鸣器 0: off 1: fast_blink 2: slow_blink 3: hold |
headLedRed | int | 料箱车顶部红灯 1: open, 0: close |
headLedYellow | int | 料箱车顶部黄灯 1: open, 0: close |
headLedGreen | int | 料箱车顶部绿灯 1: open, 0: close |
headLedFreq | int | 料箱车顶部灯工作类型 0: off 1: fast_blink 2: slow_blink 3: hold |
operation | complex | 料箱车操作选项 |
selfPosition | int | 指定料箱车自身背篓 |
changePosition0 | int | 执行chang任务的源背篓 |
changePosition1 | int | 执行chang任务的目标背篓 |
putPosition | int | 执行put任务的目标背篓 |
recAdjust | int | 识别调整 |
useLoc | 使用里程计定位 | |
unloadHeight | int | 识别货架后,放货物时高度的调整距离 |
loadHeight | int | 识别货物后,抓货物时高度的调整距离 |
goodsId | str | 货物ID |
postAddr | str | 回调服务器地址 |
postData | str | 回调数据 |
二、机构模式指令下发示例
2.1 标零操作
机器人重启或者拍急停后恢复,第一次需要执行的标零指令:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "operation": "zero" }
}
2
3
4
5
6
2.2 升降操作
料箱机器人货架抬升指令"lift"。后面的数值单位为 mm,最大值为 1850, 最小值为 380:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "lift": 1000.0 }
}
2
3
4
5
6
2.3 旋转操作
料箱机器人抽屉旋转指令"rotate"。后面的数值单位为 rad:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "rotate": 0.0 }
}
2
3
4
5
6
2.4 伸缩操作
料箱机器人抽屉臂伸出指令"stretch"。后面的数值单位为 mm。小心臂伸出装到物品:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "stretch": 0.0 }
}
2
3
4
5
6
2.5 手指操作
料箱机器人手指开关指令"finger"。后面的数值 :1 为打开,0 为关闭。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "finger": 1 }
}
2
3
4
5
6
2.6 底盘前灯操作
料箱机器人底盘前灯 chassisLedFront 开关。后面的数值 1 为打开,0 为关闭。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "chassisLedFront": 1 }
}
2
3
4
5
6
2.7 底盘后灯操作
料箱机器人底盘后灯 chassisLedBack 开关。后面的数值 1 为打开,0 为关闭。
{
"operation":"script",
"id":"SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {"chassisLedBack":1}
}
2
3
4
5
6
2.8 顶部红灯操作
料箱机器人顶部红灯 headLedRed 开关。后面的数值 1 为打开,0 为关闭。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "headLedRed": 1 }
}
2
3
4
5
6
2.9 顶部黄灯操作
料箱机器人顶部黄灯 headLedYellow 开关。后面的数值 1 为打开,0 为关闭。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "headLedYellow": 1 }
}
2
3
4
5
6
2.10 顶部绿灯操作
料箱机器人顶部绿灯 headLedGreen 开关。后面的数值 1 为打开,0 为关闭。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "headLedGreen": 1 }
}
2
3
4
5
6
2.11 顶部灯打开方式
料箱机器人顶部灯打开方式。0: off 1: fast_blink 2: slow_blink 3: hold
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "headLedFreq": 1 }
}
2
3
4
5
6
2.12 识别二维码操作
料箱机器人识别货架或者料箱二维码,visionType
参数,"shelf" 表示货架; "box" 表示料箱。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "visionType": "shelf" }
}
2
3
4
5
6
2.13 识别条形码操作
料箱机器人识别料箱一维码/条形码。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "visionType": "box", "visionBinType": "barcode" }
}
2
3
4
5
6
2.14 蜂鸣器操作
料箱机器人车蜂鸣器"buzzer", "0: off 1: fast_blink 2: slow_blink 3: hold"
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": { "buzzer": 1 }
}
2
3
4
5
6
2.15 换层操作
动作序列,将料箱机器人货架上的一层货物放到自身另外一层上。下面的例子是将 0 层货架上的货物放到 1 层货架上:
注意:需要确保初始层 changePosition0 有货
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "change",
"changePosition0": 0,
"changePosition1": 1
}
}
2
3
4
5
6
7
8
9
10
2.16 识别货架二维码放货
动作序列,将料箱机器人背篓的货物放到货架上。下面的例子是将背篓的货物放到货架上 850mm 的高度,并且货架在小车的左侧,放前先检查当前高度是否有料箱,如果没有,则识别二维码调整,抽屉伸出 900mm 将货物放置到货架上:
{
"operation":"script",
"id":"SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args":
{"operation":"unload",
"recAdjust":1,
"visionType": "shelf",
"lift":850.0,
"rotate":1.57,
"stretch":900.0
}
}
2
3
4
5
6
7
8
9
10
11
12
13
2.17 指定识别高度放货
下面的例子是将背篓的货物放到货架上 850mm 的高度,并且货架在小车的左侧,放货前先识别 recBoxLift 高度处是否有料箱,如果没有,则升到 lift 高度处识别货架二维码调整位姿,抽屉伸出 900mm 将货物放置到货架上:
{
"operation":"script",
"id":"SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args":
{"operation":"unload",
"recAdjust":1,
"visionType": "shelf",
"lift":850.0,
"rotate":1.57,
"stretch":900.0,
"recBoxLift":870
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
说明:recBoxLift 参数值设为料箱码高度,lift 参数值设为货架码高度。
2.18 指定背篓放货
动作序列,采用非识别放货方式,将料箱机器人 selfPosition 层背篓的货物放到货架上。下面的例子是将 0层背篓的货物放到货架上 850mm 的高度,并且货架在小车的左侧,抽屉伸出 900mm 将货物放置到货架上:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "unload",
"selfPosition": 0,
"lift": 850.0,
"rotate": 1.57,
"stretch": 900.0
}
}
2
3
4
5
6
7
8
9
10
11
12
2.19 识别料箱取货
动作序列,料箱机器人识别货架上的货物将其放到自己的背篓里。下面的例子是将左侧货架上,高度为 900mm 的货物,采用识别的方式取出,然后放到自己的背篓里,抽屉伸出 1000mm 就能将货物取出来:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "load",
"recAdjust": 1,
"visionType": "box",
"lift": 900.0,
"rotate": 1.57,
"stretch": 1000.0
}
}
2
3
4
5
6
7
8
9
10
11
12
13
说明:lift 参数值设为料箱码高度。
2.20 指定背篓取货
动作序列,采用识别取货方式,料箱机器人将货架上的货物放到指定的背篓里。下面的例子是将左侧货架上,高度为 900mm 的货物,采用非识别的方式取出,然后放到自己的 1 层背篓里,抽屉伸出 1000mm 将货物取出:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "load",
"selfPosition": 1,
"recAdjust": 1,
"visionType": "box",
"lift": 900.0,
"rotate": 1.57,
"stretch": 1000.0
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
2.21 识别料箱操作
动作序列,料箱机器人根据料箱的二维码进行调整。下面的例子是识别料箱上的二维码。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"recAdjust": 1,
"visionType": "box"
}
}
2
3
4
5
6
7
8
9
2.22 put操作
动作序列,料箱机器人将货叉的货物放到 1 层背篓上:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "put",
"putPosition": 1
}
}
2
3
4
5
6
7
8
9
2.23 unloadHeight 使用示例
解决货架上的二维码和货架放货的高度差别不一致的问题。这个高度差用 unloadHeight
来通过任务给定。下面的例子是:
将 0 层背篓上的货物放到货架上,并且货架在车子的左侧。料箱机器人先将货架上升到 850mm 的高度,然后旋转90度,识别货架二维码,位置调整后,再额外将货架额外抬升 100mm(unloadHeight) 这个高度,抽屉伸出 900mm 把货物放置到货架上。执行命令如下:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "unload",
"selfPosition": 0,
"recAdjust": 1,
"visionType": "shelf",
"lift": 850.0,
"rotate": 1.57,
"stretch": 1000.0,
"unloadHeight": 100.0
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2.24 loadHeight 使用示例
解决货物上的二维码,和取货的高度不一致的问题。这个高度差用loadHeight
来通过任务给定。下面的例子是:
料箱机器人识别货架上的货物将其放到自己的货架上。下面的例子是将左侧货架上有货物。料箱机器人先将货叉抬升到高度为 900mm 的货物,采用识别的方式调整姿态,再需要将抽屉高度额外调节-80 mm (loadHeight
),抽屉伸出1000mm, 把货物取出。然后放到自己的 1 层背篓里。执行命令如下:
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "load",
"selfPosition": 1,
"recAdjust": 1,
"visionType": "box",
"lift": 900.0,
"rotate": 1.57,
"stretch": 1000.0,
"loadHeight": -80.0
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2.25 识别货架码取货
解决料箱不贴码,通过识别货架二维码取货的问题。下面的例子是:
料箱机器人先将货叉抬升到高度为 900mm 的货物,采用识别货架码的方式调整姿态,再需要将抽屉高度额外调节80 mm (unloadHeight),抽屉伸出1000mm, 把货物取出,然后放到自己的背篓里。执行命令如下:
{
"operation":"script",
"id":"SELF_POSITION",
"script_name":"ctuNoBlock.py",
"script_args":{
"operation":"load",
"recAdjust":1,
"visionType":"shelf",
"lift":900,
"rotate":1.57,
"stretch":1000,
"unloadHeight":80
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
2.26 导航过程中执行货叉动作
在下发的指令中增加参数 script_stage, 值设为1,script_stage 参数定义了在导航任务中执行脚本的具体时机,详细说明可参考路径导航。
以下指令解释为 “机器人从 LM1 站点去到 LM2 站点的途中,将货叉降到400mm高度。”
{
"operation": "script",
"id": "LM2",
"task_id": "12345678",
"source_id": "LM1",
"script_name": "ctuNoBlock.py",
"script_args": { "lift": 400.0 },
"script_stage": 1
}
2
3
4
5
6
7
8
9
以下指令解释为“机器人从 LM1 去到 LM2 站点的途中,将货叉降到400mm高度,货叉旋转90度,手指打到1。”
{
"operation": "script",
"id": "LM2",
"task_id": "12345678",
"source_id": "LM1",
"script_name": "ctuNoBlock.py",
"script_args": {
"lift": 400.0,
"rotate": 1.5708,
"finger": 1
},
"script_stage": 1
}
2
3
4
5
6
7
8
9
10
11
12
13
2.27 取货前扫描条形码核对料箱编号
barcodeHeight 参数为一维码(条形码)高度值,单位:mm。goodsId 参数为料箱ID,使用任务链或者直接运行测试时,该参数填一维码的值,调度下发任务测试时,goodsId 参数由调度下发的指令携带,库位配置中应去掉goodsId参数。
{
"operation": "script",
"id": "SELF_POSITION",
"script_name": "ctuNoBlock.py",
"script_args": {
"operation": "load",
"recAdjust": 1,
"visionType": "box",
"lift": 900.0,
"rotate": 1.57,
"stretch": 900,
"barcodeHeight": 950,
"goodsId": "123456789"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
三、使用注意事项
3.1 参数配置
- 在
load
时需要将任务参数的stretch
配置合理。如果太小,将无法抓取料箱。如果太大则会推动料箱,也可能顶到对面料箱。 - 取放货位置有偏差,可以通过调整参数解决。
- load 指令中,lift 参数值建议设为料箱码的高度;unload 指令中,lift 参数值建议设为货架码与料箱码的中间高度值。
3.2 异常处理
- 异常处理请参考 料箱车异常处理手册 。
3.3 安全检查
模型文件中可配置 SafeMoveCheck 参数,该参数配置项会让料箱车每次导航移动前执行 SafeMoveCheck 配置指定的脚本任务,常用于高层料箱车运输货物前使料斗下降到合适的安全高度,以减少安全事故。SafeMoveCheck 一般会配置成标零任务。
3.4 自动切换模式
部分版本的料箱车,开机默认模式为任务模式,如果需要跑机构模式脚本,则需要设置自动切换到机构模式,在ctuNoBlock.json 文件中,将 AutoSwitchMode 参数设置成 1。
四、清空背篓数据
- 使用网线连接笔记本电脑和 AGV,将笔记本电脑有线连接 IP 地址改为 192.168.192.x (x ≠ 5)
- 打开 Roboshop 软件,点击右上角“添加设备”,输入 AGV 的 IP 192.168.192.5,点击“确认”后会自动添加机器人到页面上。
- 双击已添加的机器人进入机器人管理界面,点击页面上方菜单栏的“抢占控制权”,然后点击左下角“齿轮”图标,在弹出的界面上点击“货物配置”,可以看到 AGV 当前的背篓数据。
- 选择要清除的背篓数据,点击右下角“无货”,完成后关掉弹窗。然后点击上方菜单栏“释放控制权”。
- 完成以上步骤后可以拔出网线,重新给机器人下单。