waitForStop(3)

NAME
waitForStop, waitForStart, waitForCompleted -- syncronize with RCCL motion requests.

USAGE
waitForStop(mid)
  int mid;

waitForStart(mid)
  int mid;

waitForCompleted(mnp)
  MANIP *mnp;

ARGUMENTS

mid --
    Motion ID (returned by the motion request primitive).

mnp --
    Manipulator reference structure.

RESTRICTIONS
These primitives should probably not be called from the control level (although it is legal to do so) because if they block for any appreciable length of time the control level will timeout. An "appreciable length of time" would be any time greater than the trajectory generator sample interval.

DESCRIPTION
These functions allow an RCCL program to wait for motion requests to start or complete.

waitForStop() waits until the motion request associated with the specified motion ID has terminated. A stop code that provides information about the conditions under which the motion terminated may be obtained using motionStopCode() (q.v.). Typical values for the stop code are ON_NORMAL (normal completion as planned) or ON_ABORT (motion was aborted).

waitForStart() waits until the motion request associated with the specified motion ID has started executing. A start code that provides information about the conditions under which the motion started may be obtained using motionStartCode() (q.v.). The usual value for the start code is ON_NORMAL.

The motion ID used by the above tests is returned by the primitive that requested the motion (e.g., move() or stop()). Normally, motion IDs are assigned by the system and are recycled after NUM_SYSMFLAGS motion requests. To avoid recycling, an explicit ID may be assigned to a motion by calling the primitive setMotionFlag() before the motion request is made.

waitForCompleted() waits until all motion requests for a particular manipulator have completed, and the transition concluding the last motion has finished.

These routines are implemented as macros. If called from the planning level, they will call rcclBlock() before performing their condition check.

DIAGNOSTICS
Because these primitives are currently implemented as macros they do not directly return a proper error status. However, an error will cause them to automatically abort the program if the option RCCL_ERROR_EXIT is set (see rcclSetOptions(3)). They will also place error codes and messages on the errorStack (q.v.).

Error codes set by waitForStop() or waitForStart() include:

EDescriptor --
    The motion ID is either invalid or out of date.

No errors are currently implemented for waitForCompleted().

SEE ALSO
move(3), stop(3), motionStatus(3), setMotionFlag(3), rcclSetOptions(3), errorStack(3).