AbortMotion Statement

Aborts a motion command and puts the running task in error status.

This command is for the experienced user and you need to understand the command specification before use.

Syntax
AbortMotion

Parameters

robotNumber
Robot number that you want to stop the motion for.
All
Aborts motion for all robots.

Description
Depending on the robot status when AbortMotion is executed, the result is different as follows.

In each case, hook an error and handle the error processing with OnErr to continue the processing.

Error 2999 can use the constant ERROR_DOINGMOTION.

Error 2998 can use the constant ERROR_NOMOTION.

Write a program not to execute AbortMotion more than twice before executing the continuous execution (Cont).

  • When the robot is executing the motion command

    The robot promptly pauses the arm motion immediately and cancels the remaining motions.

    Error 2999 (ERROR_DOINGMOTION) occurs in the task which was running the motion command for the robot.

    For the following motion commands, the robot directly moves to the next position from the point where it was paused.

  • When the robot has been paused immediately

    When AbortMotion is executed, the remaining motion is canceled.

    Error 2999 (ERROR_DOINGMOTION) occurs in the task which was running the motion command for the robot when specifying the Cont statement.

    For the following motion commands, the robot directly moves to the next position from the point where it was paused.

  • When the robot is in WaitRecover status (Safeguard Open)

    When AbortMotion is executed, the remaining motion is canceled.

    The following motions can be selected with the Recover command flags.

    • When executing “Recover robotNumber, WithMove”, the robot motors turn on and the recovery motion is executed. When Cont is executed, error 2999 (ERROR_DOINGMOTION) occurs in the task which was running the motion command for the robot. For the following motion commands, the robot directly moves to the next position from the point where it was paused.
    • When executing “Recover robotNumber, WithoutMove”, the robot motors turn on. When Cont is executed, error 2999 (ERROR_DOINGMOTION) occurs in the task which was running the motion command for the robot. For the following motion commands, the robot directly moves to the next position from the point where it was paused, without the recovery motion.
  • When the robot is executing commands other than motion commands

    Error 2998 (ERROR_NOMOTION) occurs in the task which was previously running the motion command for the robot. When the task is waiting with Wait or Input commands, the task is aborted promptly and error 2998 occurs.

    When executing a motion command with CP On and a program has no more motion commands, error 2998 occurs even if the robot is running.

  • When the robot is not running from a program (task)

    An error occurs.

Notes


  • About the Controllers to use

    It cannot be used with T/VT series.


See Also
OnErr, Recover, Till

AbortMotion Statement Example
When memory I/O #0 turns on, AbortMotion is executed and the robot goes back to the home position.

Function main
  Motor On
  Xqt sub, NoEmgAbort
  OnErr GoTo errhandle

  Go P0
  Wait Sw(1)
  Go P1

  Quit sub
  Exit Function

errstart:
  Home
  Quit sub
  Exit Function

errhandle:
  Print Err
  If Err = ERROR_DOINGMOTION Then
    Print "Robot is moving"    ' Executing Go P0 or Go P1
    EResume errstart
  ElseIf Err = ERROR_NOMOTION Then
    Print "Robot is not moving"    ' Executes Wait Sw(1)
    EResume errstart
  EndIf

  Print "Error Stop"    ' Other error occurs
  Quit All
Fend

Function sub
  MemOff 0
  Wait MemSw(0)
  AbortMotion 1
  MemOff 0
Fend