2023-07-12
Our ABB robot program mainly consists of three module modules:
1. Admin
2. Machine specific action program (we call it Job)
3. write RegPos (used as a marker after executing a specific position in the job)
In the above part of the program, we mainly modified the 2module module, which includes many jobs, and each job is a specific program that implements robot position movement.
Any program has a program entry point, and so do robot programs. And the entrance to our robot program is in the Admin program. The source code of the Admin program's main() is as follows. Please note that we have seen PROC main(). The programming unit for ABB robots is the procedure, abbreviated as PROC. The main procedure for this Admin program is basically after creating a new machine:
PROC main()
CONNECT fTCPSpeedHigh WITH IGenRobotMoving;
CONNECT fTCPSpeedLow WITH IGenRobotMoving;
ISignalAO virt_TCPSpeed_Robot1, AIO_ABOVE_HIGH, 0.02, 0, 0, fTCPSpeedHigh;
ISignalAO virt_TCPSpeed_Robot1, AIO_BELOW_HIGH, 0.015, 0, 0, fTCPSpeedLow;
IF OpMode()=OP_MAN_PROG THEN
TPErase;
TPReadFK FunkTaste,"Select move jobs by manual mode?","","","","No","Yes";
IF FunkTaste=5 THEN
Manual;
ELSE
TPErase;
TPWrite "Robot Moving in Manual Mode";
TPWrite "Communication with Master-PLC";
ENDIF
ELSE
TypNum:=0;
JobNum:=0;
Funktaste:=0;
ENDIF
Initialize;
SpeedLimiter;
pStartingPoint:=CRobT(Tool:=tool0 WObj:=wobj0);
regStartingAngleX:=EulerZYX(X, pStartingPoint.rot);
regStartingAngleY:=EulerZYX(Y, pStartingPoint.rot);
regStartingAngleZ:=EulerZYX(Z, pStartingPoint.rot);
regStoppedAngleX:=EulerZYX(X, pPointAtStop.rot);
regStoppedAngleY:=EulerZYX(Y, pPointAtStop.rot);
regStoppedAngleZ:=EulerZYX(Z, pPointAtStop.rot);
IF (pPointAtStop.trans.X>=(pStartingPoint.trans.X+regTransDiff) OR
pPointAtStop.trans.X<=(pStartingPoint.trans.X-regTransDiff) OR
pPointAtStop.trans.Y>=(pStartingPoint.trans.Y+regTransDiff) OR
pPointAtStop.trans.Y<=(pStartingPoint.trans.Y-regTransDiff) OR
pPointAtStop.trans.Z>=(pStartingPoint.trans.Z+regTransDiff) OR
pPointAtStop.trans.Z<=(pStartingPoint.trans.Z-regTransDiff)) OR
(regStoppedAngleX>=(regStartingAngleX+regRotDiff) OR
regStoppedAngleX<=(regStartingAngleX-regRotDiff) OR
regStoppedAngleY>=(regStartingAngleY+regRotDiff) OR
regStoppedAngleY<=(regStartingAngleY-regRotDiff) OR
regStoppedAngleZ>=(regStartingAngleZ+regRotDiff) OR
regStoppedAngleZ<=(regStartingAngleZ-regRotDiff)) OR
pPointAtStop.robconf<>pStartingPoint.robconf THEN
Set DO13_RobotHasBeenMoved;
ENDIF
WHILE di8_HsStartMain=0 DO
SetGO DO32_39_HsStepCode,0;
WaitDI DI10_ReadJobCode,1;
VelSet DI40_47_Override, 7500; !Speed is set to max
SetGO DO24_31_HsJobCode,DI24_31_JobCode;
SetDO DO10_HsReadJobCode,1;
WaitDI DI10_ReadJobCode,0;
SetDO DO10_HsReadJobCode,0;
!Call Jobprogram
CallByVar "Job",DI24_31_JobCode;
ENDWHILE
ENDPROC
This program is a bit long, and I don't want to introduce it too much. I mainly want to talk about the last section of the program, because this section is the implementation of how the robot calls the Job program in the second module when moving its position. I think this is also what most people who want to learn about robot programs want to know and understand the most:
Firstly, the first sentence WHILE di8_ HsStartMain=0 DO
Note that 'DI8_HsStartMain' means' Handshake 'Start Main done'
This means that when the Bool signal HsStartMain of the digital input is 0, it means that the Main has not been started yet. We need to execute While Do to complete all the code. There are quite a few codes here, and I will give an example, such as the second one
WaitDI DI10_ ReadJobCode, 1; The meaning of the annotation variable "DI10_ReadJobCode" is the handshake signal Handshake "read Job" from the PLC.
Okay, so how exactly does it make robots execute various jobs? Don't worry, that's it:
! Call Jobprogram is just a comment
CallByVar "Job", DI24_ 31_ JobCode; This sentence is the essence.
Send your inquiry directly to us