ERROR Handler not catching overload error: 50055 Joint Load too high

Hi Dave,

I think the function ReadErrData does what you are looking for.
It can be used in a Trap routine to get the Error Domain (errdomain datatype) that gives you the prefix, which is 5, for motion errors.
It is explained with basic examples in the Rapid Instructions Help available through RobotStudio.

Good Luck,

Harry

Here’s background task I use for catching errors (parts of dealing with regain distances are dis-included because in this facility the regain distances are VERY small ≈1mm). A log is written to on an external PC that I have NOT included the parameters for:

VAR intnum intMotErr_interrupt;
VAR intnum intHWareErr_interrupt;
VAR intnum intRegain_interrupt;
VAR errdomain err_domain;
VAR num err_number;
VAR errtype err_type;
VAR trapdata err_data;
VAR string strCtrlId;
VAR string string1;
VAR string string2;
VAR string stEorW;

VAR iodev textfile;
VAR iodev io_DeviceName;
VAR string tempstring;

PERS num nProgNum:=88;

PROC main()

IDelete intMotErr_interrupt;
IDelete intHWareErr_interrupt;
IDelete intRegain_interrupt;
WHILE TRUE DO
IDelete intMotErr_interrupt;
IDelete intHWareErr_interrupt;
IDelete intRegain_interrupt;
CONNECT intMotErr_interrupt WITH trErrLog;
IError MOTION_ERR,err_type,intMotErr_interrupt;
CONNECT intHWareErr_interrupt WITH trErrLog;
IError HARDWARE_ERR,err_type,intHWareErr_interrupt;
CONNECT intRegain_interrupt WITH trRegain;
ISignalDO do_Eax_RegainErr1,1,intRegain_interrupt;
WaitTime 0.01;
ENDWHILE
ENDPROC

TRAP trErrLog
strCtrlId:=GetSysInfo(\CtrlId);

GetTrapData err_data;
ReadErrData err_data,err_domain,err_number,err_type;
IF err_number<10 THEN
string1:=ValToStr(err_number);
string2:=“000”+string1;
ELSEIF err_number>=10 AND err_number<=99 THEN
string1:=ValToStr(err_number);
string2:=“00”+string1;
ELSEIF err_number>=100 AND err_number<=999 THEN
string1:=ValToStr(err_number);
string2:=“0”+string1;
ELSEIF err_number>999 THEN
string2:=ValToStr(err_number);
ENDIF
Open “ExternalPC:”\File:=“ErrLogging.txt”,io_DeviceName\Append;
Write io_DeviceName,strCtrlId;
Write io_DeviceName,CDate()\NoNewLine;
Write io_DeviceName," "+CTime();
Write io_DeviceName,stEmpty;
tempstring:=ValToStr(err_domain);

IF err_type=2 THEN
stEorW:=“Warning”;
ELSEIF err_type=3 THEN

stEorW:=“ERROR”;
ELSE
stEorW:=“\A0”;
ENDIF
Write io_DeviceName,stEorW+" number = “\NoNewLine;
Write io_DeviceName,tempstring+string2;
Write io_DeviceName,stEmpty;
Write io_DeviceName,”************";
Write io_DeviceName,stEmpty;
Close io_DeviceName;
ERROR
IF ERRNO=ERR_FILEACC OR ERRNO=ERR_FILNOTFND OR ERRNO=ERR_FILEOPEN THEN
SkipWarn;
TRYNEXT;
ENDIF
ENDTRAP

Sample Output:


6640-103713
2022-05-05 09:35:11

ERROR number = 50056


Thank you Harry. That’s what I needed. I had it in my head that err_domain was the error type (state, warn, err).

And thank you SomeTekk for the example. Logging is on my list of things to get done. I’m curious why you use IDelete when you enter the routine and again inside the loop.

IDelete is in both those places in case, probably irrationally, a colleague changes the Task Type.