Runtime error/Infinite loop
Why do I get the message "Runtime error"?
Examples are valid for:
CB2 Software version: 1.8.16941
CB3 Software version: 3.3.0.145
e-Series Software version: 5.1
Note that older or newer software versions may show differently message.
These examples can be used for both CB2,CB3 and e-Series.
During programming the robot, you might encounter a runtime error like this:
or
This can happen in the RobotProgram or in any Thread.
The reason of this error, is that the program loops, but the lines in the program does not take any physical time.
As an example, this program would cause an "infinite loop" error.
This error happens dut to the fact, that all 3 assignment operations does not use physical time. And since the program is looping, the program is running infinitely fast in infinite circles.
The method of solving this, is to insert a command that uses physical time.
These commands use physical time:
- Wait (wait for a given time, e.g. 0.01 s)
- sync() script command
- Robot movements (e.g. a move command to a position whete the robot isn't already)
Thus, inserting a "Wait: 0.01" command into the program resolves the runtime error.
Other more complex programs might as well cause this error.
In below program, if both "something_A" and "something_B" is False, then the robot program will loop infinitely, because no commands are executed.
RobotProgram If (something_A) MoveJ Waypoint 1 Waypoint 2 Waypoint 3 ElseIf (something_B) MoveL Waypoint 4 Waypoint 5 Waypoint 6 |
The runtime error can be solved by inserting e.g. a "sync()" script command at the end of the program.
Then, if both IF-statements are false, the robot will spend physical time at the "sync()" command.
Thus:
RobotProgram If (something_A) MoveJ Waypoint 1 Waypoint 2 Waypoint 3 ElseIf (something_B) MoveL Waypoint 4 Waypoint 5 Waypoint 6 sync() |