RobotStudio event

Issues using ClearPath

Hi,

I am currently controlling an IRB120 using robotstudio and matlab. What I am trying to get working at this moment is:
  1. Giving the robot a target
  2. Stopping somewhere along the way
  3. Giving another target and "forgetting" about the first one.

The robot is controlled using multi-tasking. One task is the motion task and is a simple loop doing:

IF UpdateReady = TRUE THEN

UpdatePos;
ENDIF

The UpdatePos proc has a few IF/ELSE statements in order to move linearly, jointmode, to an  XYZ target or to a joint target, and ends with either a MoveL or MoveAbsJ.
The other task receives the targets, stop and run commands.

In that communication task, when receiving a stop command I simply call

StopMove \AllMotionTask; (that argument may or may not be useful?)

and

If IsStopMoveAct ( \FromNonMoveTask) = TRUE THEN
StartMove;
ENDIF
to start it again, this sends it to its old target.

When I want to update the position, I have added this (still in the communication task, since that one runs the stopMove it also has to run the StartMove)
If IsStopMoveAct ( \FromNonMoveTask) = TRUE THEN
ClearPath;
StartMove;
ENDIF

I guess there must be a misunderstanding somewhere, but I can't find why this wouldn't work. When looking at the program pointers in robotstudio, it seems that the robot will stay on the "MoveAbsJ" or "MoveL" instruction until it executes it completely. What currently happens is :

  • I give a target
  • I stop the robot
  • Give another target
  • The robot goes to the first target, then directly to the second one.

Thanks for any input.

Comments

  • As far as I know the robot will not stop executing a MoveAbsJ or MoveL untill the target is reached. The program pointer may go ahead of execution, but it will still complete it. There is a function called SearchL that might be something you can use, but the ones you mentioned will not work as you want. Something to note is also that ClearPath introduces a second delay.
  • I managed to stop it using this way:
    • Task B receives target 1
    • Task A sends robot to target 1
    • Task B receives target 2, orders a procerrRecovery
    • Task A catches the error, uses ClearPath in error handler

    This allows for the robot to stop midway and change direction. However, it seems bad practice to use an error handler, it spits out an error on the output "Process failed" because the procerrRecovery cancels an instruction, and in simulation the robot still seems to go towards target 1 for half a second before going to target 2.