# Catching Kinematic Error

**URL:** <https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920>\
**Category:** RAPID Programming\
**Created:** [January 17, 2021, 1:23pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920 "2021-01-17T13:23:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 17, 2021, 1:23pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/1 "2021-01-17T13:23:45Z")

</div>

Dear colleagues,  
I am quite new to RAPID programming, so I apologize if my question is too trivial.

I need a mechanism to catch kinematic errors if they happen and continue execution of the program. Example:  
MODULE MyModule  
VAR bool error\_flag := FALSE;

PROC MyProc()  
! The following line generates error 50065 “Kinematic error”  
MoveAbsJ somewhere\_out\_of\_reach, speed, zone, tool;

! I want the execution to continue here after the error  
TPWrite “The show must go on!”, \Bool=error\_flag;

ERROR  
TPWrite “Hello from error handler!”;  
error\_flag := TRUE;  
TRYNEXT;  
ENDPROC  
ENDMODULE

However, the ERROR handler is never executed – the program simply stops and an error message is logged.

What am I missing?

---

<div class="post-metadata">

**Author:** ![VictorAx](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@VictorAx](https://tech-community.robotics.abb.com/u/VictorAx)\
**Post date:** [January 18, 2021, 3:37pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/2 "2021-01-18T15:37:00Z")

</div>

I’ve done something similar;

MODULE MyModule  
VAR bool error\_flag := FALSE;

PROC MyProc()  
! Create a temp jointtarget  
VAR jointtarget jntReach;

! The jointtarget is crated from the position, somewhere\_out\_of\_reached should be a robtarget

jntReach := CalcJointT(somewhere\_out\_of\_reach, tool\wobj);

! If this point isn’t reachable, error ERR\_OUTSIDE\_REACH or ERR\_ROBLIMIT is raised

MoveAbsJ somewhere\_out\_of\_reach, speed, zone, tool;

! I want the execution to continue here after the error  
TPWrite “The show must go on!”, \Bool=error\_flag;

ERROR  
SkipWarn; !Don’t raise an error

TPWrite “Hello from error handler!”;  
error\_flag := TRUE;  
TRYNEXT;  
ENDPROC  
ENDMODULE

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 12:29pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/3 "2021-01-20T12:29:50Z")

</div>

@VictorAx I tried adding SkipWarn as you suggest, but it does not change the behavior of the program. The program simply stops with the “Kinematics error” message, and the ERROR handler is never called (also no “Hello from error handler!” message on FlexPendant). What am I missing?

---

<div class="post-metadata">

**Author:** ![xerim](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xerim](https://tech-community.robotics.abb.com/u/xerim)\
**Post date:** [January 20, 2021, 1:08pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/4 "2021-01-20T13:08:10Z")

</div>

If configuration is not a concern you can turn use ConfJ\Off for singularity issues, for out of reach positions I would verify that the robot can reach the points in RobotStudio prior to execution.

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 1:19pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/5 "2021-01-20T13:19:11Z")

</div>

> [@xerim](#):
>
> If configuration is not a concern you can turn use ConfJ\Off for singularity issues, for out of reach positions I would verify that the robot can reach the points in RobotStudio prior to execution.

Verifying the motion prior to execution is always a good idea. But what I want to do here is to handle unexpected motion errors and notify a supervising PC than an error has happened.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 20, 2021, 1:39pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/6 "2021-01-20T13:39:33Z")

</div>

Actually, the CalcJointT function should error if the calculated Jointtarget is out of reach. If you still do not see it passing into your error handler you might try the RAISE instruction.

 ![image.png](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/2X/7/7e0c0d7a1cf8f0c1191db2d9750988e9e68a6d04.png)

---

<div class="post-metadata">

**Author:** ![xerim](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xerim](https://tech-community.robotics.abb.com/u/xerim)\
**Post date:** [January 20, 2021, 1:39pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/7 "2021-01-20T13:39:36Z")

</div>

Do you have multitasking? You can restart the system in the background with multitasking

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 1:55pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/8 "2021-01-20T13:55:19Z")

</div>

> [@xerim](#):
>
> Do you have multitasking? You can restart the system in the background with multitasking

Yes I have multitasking. But how can I automatically detect a condition such as a kinematics error?

---

<div class="post-metadata">

**Author:** ![xerim](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xerim](https://tech-community.robotics.abb.com/u/xerim)\
**Post date:** [January 20, 2021, 2:42pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/9 "2021-01-20T14:42:45Z")

</div>

From the [Technical Reference Manual](https://library.e.abb.com/public/b227fcd260204c4dbeb8a58f8002fe64/Rapid_instructions.pdf?x-sign=f79v/883X1nHGc8fqH+WAJ2F30y/M6TZfYUuPuQpP+jeMBygouyGg+WSj8A9Otry)

 ![image.png](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/1X/6f42c7a106b39e689241e9788a8fcdbee13a946c.png)

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 2:50pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/10 "2021-01-20T14:50:35Z")

</div>

@xerim your example is very similar to what I wrote in my first post. The problem is that it works for division by 0 but does not work for kinematic error.

---

<div class="post-metadata">

**Author:** ![xerim](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xerim](https://tech-community.robotics.abb.com/u/xerim)\
**Post date:** [January 20, 2021, 2:54pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/11 "2021-01-20T14:54:48Z")

</div>

You could try to configure a virtual analog output that is connected to the execution error you are experiencing, then create a procedure which restarts the system in the background when that signal is set to high.

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 3:02pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/12 "2021-01-20T15:02:54Z")

</div>

> [@](#):
>

– how can I do this?

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 20, 2021, 3:06pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/13 "2021-01-20T15:06:23Z")

</div>

Change your Error handler handler to what follows, more or less.  
TEST ERRNO  
CASE 50065:  
TPWrite “blah blah”;  
TRYNEXT;  
DEFAULT  
Stop;  
! Look in program data for ERRNO value, match it with predefined Error numbers  
! This helps in finding unanticipated errors  
ENDTEST

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 20, 2021, 6:00pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/14 "2021-01-20T18:00:37Z")

</div>

@lemster68 The problem is that the error handler NEVER FIRES in case of kinematic error!

---

<div class="post-metadata">

**Author:** ![xerim](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xerim](https://tech-community.robotics.abb.com/u/xerim)\
**Post date:** [January 20, 2021, 6:20pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/15 "2021-01-20T18:20:39Z")

</div>

> [@mkatliar](#):
>
> @lemster68 The problem is that the error handler NEVER FIRES in case of kinematic error!

That is because you don’t have it set up in the way lemster has suggested. Compare the example code he provided to the code you have in your original post.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 20, 2021, 7:10pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/16 "2021-01-20T19:10:33Z")

</div>

I did mention in an earlier post that you may need to use the RAISE instruction for the error. Also, the best way to troubleshoot such things is to single step forward one line at a time instead of pressing the start button. Then you can see how the logic evaluates both TRUE or FALSE.

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 23, 2021, 9:22pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/17 "2021-01-23T21:22:03Z")

</div>

Hello @lemster68,  
have a look at step-by-step execution of the program: [https://youtu.be/-XQimhLkxCQ](https://youtu.be/-XQimhLkxCQ)

As I did mention before, in the case of kinematic error the program DOES NOT ENTER THE ERROR HANDLER. Therefore it does not matter what you put there.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 25, 2021, 1:04pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/18 "2021-01-25T13:04:00Z")

</div>

What is the error code 194?

---

<div class="post-metadata">

**Author:** ![mkatliar](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mkatliar](https://tech-community.robotics.abb.com/u/mkatliar)\
**Post date:** [January 25, 2021, 2:28pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/19 "2021-01-25T14:28:23Z")

</div>

@lemster68 it is division by 0, obviously.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 25, 2021, 2:38pm UTC](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920/20 "2021-01-25T14:38:34Z")

</div>

I did not look at the values for those variables. There is no CalcJointT function there, which should throw an error if it is out of range. I would normally use the step forward button on the virtual TP.

[Next page](https://tech-community.robotics.abb.com/t/catching-kinematic-error/9920.md?page=2)
