I need your advise again. My intention is to make sure the turn table is manually turned to about 0? before the starting of process. If the turntable is <-5 and >5, then it will not be able to proceed further. However, I don’t know what is the corrent syntax for eax_c. Thanks.
VAR robtarget pTemp;
Setzero:
TPReadFK nEax,“Turn Table at Zero Degree? Turn to zero if not!”,“No”,“”,“”,“”,“Yes”;
IF nEAX<2 GOTO Setzero;
pTemp := CRobT();
TPWrite "The value is now "+ValToStr(pTemp.extax.eax_c);
FUNC bool TestPos()
VAR robtarget pTemp;
VAR num nEax:=1;
pTemp := CRobT();
!check if abs val > 5, if so force the user to move it to zero before proceeding
IF Abs(pTemp.extax.eax_c)>5 THEN
WHILE nEax < 5 DO
TPReadFK nEax,“The turntable is not at zero. Do you want to move it?”,“No”,“”,“”,“”,“Yes”;
WaitTime 1;
ENDWHILE
pTemp.extax.eax_c:=0;
!Force the user to authorize movement
TPReadFK nEax,“The turntable is about to move, press OK when it is safe to continue.”,“Cancel”,“”,“”,“”,“OK”;
TEST nEax
CASE 5:
MoveJ pTemp,v100,fine,tool0;
WaitTime InPos, 2;
pTemp := CRobT();
IF Abs(pTemp.extax.eax_c)<5 THEN
TPWrite “The turntable is now at or near zero, returning true”;
RETURN TRUE;
ELSE
TPWrit e “The turntable is still not at zero, returning false”;
Return FALSE;
ENDIF
DEFAULT:
TPWrite “You have canceled the motion, returning false”;
Return FALSE;
ENDTEST
ELSE
!already less than 5 degrees away from zero
TPWrite “The turntable is at or near zero, OK to proceed”;
Return TRUE;
ENDIF
ENDFUNC
After studying your advise, I have used what you have taught to change my program and it works.
However, now i have a problem. My program is such that:-
If Abs(pTemp.extax.eax_c)>5, it will prompt the operator the current turn table degree, then telling him not safe to proceed. The operator has to manually turn the turntable to be within 5 degrees in order to proceed.
The problem is sometimes, for example, the turn table is registered at 3600 degrees, which is basically (10 revolutions from 0 degrees). Now, the operator has to manually turn the table 10 revolutions to get back to 0 degree before he can proceed!
How am I going to reset the measuring system of the external axis to 0 degrees in this case? Can teach me the correct syntax?
I have seen this syntax “IndReset ROBAX,1RefPos:=pHomeShort;” Is this applicable in my case?
I’m not really the expert on motion programming and external axes, maybe someone else can weigh in on this?
Reading the documentation, it sounds like it is possible to what you wish. You need to verify that you have the software option Independent Axes installed to be able to use these instructions.