代码:
输入help("robolink")或help("robodk")查看更多信息
#按F5运行脚本
#文档://www.x7093.com/doc/en/RoboDK-API.html
#参考://www.x7093.com/doc/en/PythonAPI/index.html
#注意:不需要保留此文件的副本,您的python脚本将与站点一起保存
从robolink导入* # RoboDK API
从robodk导入机器人工具箱
从M75_Pick_Place导入*
从M75_Place_Clean导入*
进口线程
导入的时间
def run_robot_a ():
从机器人A的站树中收集所需的物品
rdk_a = Robolink()
robot_a = rdk_a.Item('UR5e')
rdk_a。ShowMessage(“机器人”)
#robot_a = rdk_a.Item('UR5e')
a_home = rdk_a.Item(' a_home ') #联合目标
a_pick_to_clean_0 = rdk_a.Item('A_PICK_TO_CLEAN0') #联合目标
a_pick_to_clean_1 = rdk_a.Item('A_PICK_TO_CLEAN1') #联合目标
a_pick_to_clean_2 = rdk_a.Item('A_PICK_TO_CLEAN2') #联合目标
a_pick_to_clean_3 = rdk_a.Item('A_PICK_TO_CLEAN3') #联合目标
Bin_input_active = rdk_a。项目('Active Input Bin') # 'Active Bin'参考框
M75_tray = rdk_a。项目(“M75输入托盘”)#“M75托盘”的参考框
item ('Disk3A') #Disk3A参考框
item ('Disk1A') #Disk1A参考框
robot_a.setPoseFrame (bin_input_active)
Blade_count = 0
#设置机器人A的线速度,加速度和圆
robot_a.setSpeed (500)
robot_a.setAcceleration (1200)
robot_a.setRounding (20)
#从安全位置开始
robot_a.MoveJ (a_home)
robot_a.MoveJ (a_pick_to_clean_0)
#在每个位置循环
当blade_count < 84:
#更新active bin的位置
M75_set_active_bin_pos (rdk_a, robot_a, blade_count)
#选择
robot_a.setSpeed (500)
m75_pick_fwd (rdk_a robot_a)
抓地力部分
m75_pick_rev (rdk_a robot_a)
robot_a.setSpeed (500)
#暂停
robot_a.Pause (0.5)
#安全离开选择区域
robot_a.setRounding (20)
robot_a.MoveJ (a_pick_to_clean_0)
robot_a.MoveJ (a_pick_to_clean_1)
robot_a.MoveJ (a_pick_to_clean_2)
robot_a.MoveJ (a_pick_to_clean_3)
#清洁磁盘3A
robot_a.setPoseFrame (disk_3a)
m75_clean_3a (rdk_a robot_a)
#重置清洗位置
robot_a.MoveJ (a_pick_to_clean_3)
#清洁磁盘1A
robot_a.setPoseFrame (disk_1a)
m75_clean_1a (rdk_a robot_a)
从洁净区安全移动到采摘区
robot_a.setRounding (20)
robot_a.MoveJ (a_pick_to_clean_3)
robot_a.MoveJ (a_pick_to_clean_2)
robot_a.MoveJ (a_pick_to_clean_1)
robot_a.MoveJ (a_pick_to_clean_0)
robot_a.setPoseFrame (bin_input_active)
#位置
robot_a.setSpeed (500)
m75_place_fwd (rdk_a robot_a)
#此处释放部分
m75_place_rev (rdk_a robot_a)
robot_a.setSpeed (500)
#暂停
robot_a.Pause (0.5)
增加下次拾取的刀片数量
Blade_count = Blade_count + 1
#安全移动回原位
robot_a.MoveJ (a_pick_to_clean_0)
robot_a.MoveJ (a_home)
def run_robot_b ():
从机器人B的站树中收集所需的物品
rdk_b = Robolink()
robot_b = rdk_b.Item('UR5e2')
rdk_b。ShowMessage (B“机器人”)
#robot_b = rdk_a.Item('UR5e2')
Bin_output_active = rdk_b.日志含义项目('Active Output Bin') # 'Active Bin'参考框
Table_center = rdk_b。项目(“表中心”)
b_home = rdk_b.Item(' b_home ')
b_home_to_clean = rdk_b.Item(' b_home_to_clean ')
b_place_to_clean_0 = rdk_b.Item('B_PLACE_TO_CLEAN0')
b_place_to_clean_1 = rdk_b.Item('B_PLACE_TO_CLEAN1')
b_place_to_clean_2 = rdk_b.Item('B_PLACE_TO_CLEAN2')
b_place_to_clean_3 = rdk_b.Item('B_PLACE_TO_CLEAN3')
Blade_count = 0
#设置机器人A的线速度,加速度和圆
robot_b.setSpeed (500)
robot_b.setAcceleration (1200)
robot_b.setRounding (20)
#从安全位置开始
robot_b.MoveJ (b_home)
#从主位置移动到清洁位置
robot_b.MoveJ (b_home)
robot_b.MoveJ (b_home_to_clean)
robot_b.MoveJ (b_place_to_clean_3)
#在每个位置循环
当blade_count < 84:
#交换
# robot_b.setPoseFrame (table_center)
# b_m75_swap (rdk_b robot_b)
# robot_b.MoveJ (b_place_to_clean_1)
# robot_b.MoveJ (b_place_to_clean_2)
#清理磁盘3B
robot_b.Pause (0.50)
#从清洁区域移动到拾取区域
robot_b.MoveJ (b_place_to_clean_3)
robot_b.MoveJ (b_place_to_clean_2)
robot_b.MoveJ (b_place_to_clean_1)
robot_b.MoveJ (b_place_to_clean_0)
#位置
robot_b.setPoseFrame (bin_output_active)
#更新active bin的位置
B_m75_set_active_bin_pos (rdk_b, robot_b, blade_count)
robot_b.setSpeed (500)
b_m75_place_fwd (rdk_b robot_b)
#此处释放部分
#暂停
robot_b.Pause (0.25)
b_m75_place_rev (rdk_b robot_b)
robot_b.setSpeed (500)
#安全地从指定区域移动到清洁区域
robot_b.setRounding (20)
robot_b.MoveJ (b_place_to_clean_0)
robot_b.MoveJ (b_place_to_clean_1)
robot_b.MoveJ (b_place_to_clean_2)
robot_b.MoveJ (b_place_to_clean_3)
增加下一个位置的刀片数量
Blade_count = Blade_count + 1
#安全移动回原位
robot_b.MoveJ (b_home)
##-------------------------- 最大宽度 -----------------------------------------#
##程序从这里开始:
demask_station = Robolink()
#robot_a = demask_station.Item('UR5e')
#robot_b = demask_station.Item('UR5e2')
# demask_station。ShowMessage(“线程”)
Thread_a = threading。线程(target = run_robot_a, args = ())
Thread_b = threading。线程(target = run_robot_b, args = ())
thread_a.start ()
thread_b.start ()
thread_a.join ()
thread_b.join ()
# demask_station。ShowMessage(“线程”)