埃斯顿机器人编程实例 (取板机械手)

1, 变量定义 (此处都定义为全局变量)

 

 

 

 2, 以下内容为具体程序

 

 ①主程序

Start:
//初始化
CALL rInital
WHILE (true) DO
    CALL rPick1
    CALL rPlace
    CALL rPick2
    CALL rPlace
ENDWHILE
End;

 

②笔记

Start:
MovJ(g:pHome,s:V100,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
MovL(g:pHome,s:V100,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
//工件坐标基础上偏移
MovLRel(g:pOffsetX,"COORD",s:V100,"RELATIVE",s:C10,g:PAYLOAD0)
MovLRel(g:pOffsetX,"COORD",s:V100,"RELATIVE",s:C10,g:PAYLOAD0)
MovLOffset(g:pPick_P1,g:pOffsetZ,"COORD",s:nullTool,s:World,s:V100,"RELATIVE",s:C10,g:PAYLOAD0)
//设置负载质量
SetPayload(g:PAYLOAD0)
//全局速度设置功能。设置“全局速度”为一个合适的百分比数值
SetOverRide(20)
//选择用户坐标系指令
SetCoord(s:World)
//选择工具坐标系指令
SetTool(s:nullTool)
//6轴回原
RefRobotAxis(1,0)
RefRobotAxis(2,0)
RefRobotAxis(3,0)
RefRobotAxis(4,0)
RefRobotAxis(5,0)
RefRobotAxis(6,0)
//点位赋值
g:pHome = g:pPick_P1
g:pHome.z = 640
//一直等待一个条件
WaitSimDI(g:diAllowPick,1,0,0,l:INT0)
//获取当前位置
GetCurCPos(g:pCurPos)
//and, or等逻辑语句使用
IF (g:diCheck1.value == 0 or g:diCheck2.value == 0) THEN
    PulseSimOut(g:doPickErr,1,1000,0)
    Stop()
ENDIF
End;

③初始化

Start:
SetSimDO(g:doHomeDone,0)
SetSimDO(g:doGripCylinder,0)
SetSimDO(g:doInsertCylinder,0)
SetSimDO(g:doPickDone,0)
SetSimDO(g:doPickErr,0)
SetSimDO(g:doPlaceErr,0)
//X方向偏移变量?????
g:pOffsetY.dx = 0
g:pOffsetY.dy = 150
g:pOffsetY.dz = 0
g:pOffsetY.da = 0
g:pOffsetY.db = 0
g:pOffsetY.dc = 0
//Z方向偏移变量?????
g:pOffsetZ.dx = 0
g:pOffsetZ.dy = 0
g:pOffsetZ.dz = 50
g:pOffsetZ.da = 0
g:pOffsetZ.db = 0
g:pOffsetZ.dc = 0
g:pPrePick1 = g:pPick_P1
g:pPrePick1.z = g:pPick_P1.z + 50
g:pPrePick2 = g:pPick_P2
g:pPrePick2.z = g:pPick_P2.z + 50
g:pPrePlace = g:pPlace_P3
g:pPrePlace.z = g:pPlace_P3.z + 100
MovLRel(g:pOffsetZ,"COORD",s:V100,"RELATIVE",s:C10,g:PAYLOAD0)
MovJ(g:pPassPoint,s:V100,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
MovJ(g:pHome,s:V100,"FINE",s:nullTool,s:World,g:PAYLOAD0)
PulseSimOut(g:doHomeDone,1,1000,0)
Stop()
//WaitSimDI(g:diAutoRun,1,0,0,l:INT0)
End;

 

④取料1子程序

Start:
//等待取料
MovJ(g:pPrePick1,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
WaitSimDI(g:diAllowPick,1,0,0,l:INT0)
//取料进行中
MovL(g:pPick_P1,s:V100,"FINE",s:nullTool,s:World,g:PAYLOAD0)
SetSimDO(g:doGripCylinder,1)
SetSimDO(g:doInsertCylinder,1)
Wait(500)
//取料完成
MovL(g:pPrePick1,s:V200,"FINE",s:nullTool,s:World,g:PAYLOAD0)
IF (g:diCheck1.value == 0 or g:diCheck2.value == 0) THEN
    PulseSimOut(g:doPickErr,1,1000,0)
    Stop()
ENDIF
End;

 

⑤取料2子程序

Start:
//等待取料
MovJ(g:pPrePick2,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
//取料进行中
MovL(g:pPick_P2,s:V100,"FINE",s:nullTool,s:World,g:PAYLOAD0)
SetSimDO(g:doGripCylinder,1)
SetSimDO(g:doInsertCylinder,1)
Wait(500)
//取料完成
MovL(g:pPrePick2,s:V200,"FINE",s:nullTool,s:World,g:PAYLOAD0)
MovLRel(g:pOffsetY,"COORD",s:V200,"RELATIVE",s:C10,g:PAYLOAD0)
IF (g:diCheck1.value == 0 or g:diCheck2.value == 0) THEN
    PulseSimOut(g:doPickErr,1,1000,0)
    Stop()
ENDIF
//取料完成交互
SetSimDO(g:doPickDone,1)
WaitSimDI(g:diAllowPick,0,0,0,l:INT0)
SetSimDO(g:doPickDone,0)
End;

 

⑥卸料子程序

Start:
MovJ(g:pPassPoint,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
MovJ(g:pPrePlace,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
//等待允许放料
WaitSimDI(g:diAllowPlace,1,0,0,l:INT0)
MovJ(g:pPlace_P3,s:V200,"FINE",s:nullTool,s:World,g:PAYLOAD0)
SetSimDO(g:doInsertCylinder,0)
SetSimDO(g:doGripCylinder,0)
Wait(300)
MovL(g:pPrePlace,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
MovJ(g:pPassPoint,s:V500,"RELATIVE",s:C10,s:nullTool,s:World,g:PAYLOAD0)
End;

 

posted @ 2023-03-04 09:24  CSF践行  阅读(5418)  评论(1编辑  收藏  举报