MotionComp
(Library)
[Version 1.5 or later]
Judges whether execution of running motion commands is complete.
MotionComp(<MotionCommandComplete>)
If MotionComp judges that execution of running motion commands is complete, then it returns "1" in <MotionCommandComplete>.
This command checks motion commands running in the task in which the MotionComp executes. It is not applicable to motion commands in any other tasks.
If a motion command has an encoder value check option, then MotionComp will interpret the moment when the encoder count is converged within the positioning error allowance as completion of the motion command. For other operations, if motion control to the servo loop disappears, then MotionComp will judge that the command is complete.
-
Execute this command in a TAKEARMed task that holds an arm semaphore. If not in a TAKEARMed task, the error "Not executable" will result.
-
Executing MotionComp in a robot motion task will judge whether robot motion commands are complete. Executing it in an extended-joint motion task will judge whether extended-joint motion commands are complete.If MotionComp executes in a motion task holding an arm group involving both robot joints and extended-joints, then completion of both the robot and extended-joint motions will be judged.
-
When the motion is on Halt, MotionComp will interpret it as operation being in progress.
-
If you use a local variable for <MotionCommandComplete>, the local variable must be reset to "0" beforehand.
defint comp=0
|
'Initialize motion command completion status.
|
defjnt lj1
|
|
defsng lf1
|
|
move p,P1,next
|
|
DO
|
|
lj1=GetSrvState(2)
|
'Get error of each joint rotation.
|
lf1=ABS(JOINT(2,lj1))
|
'Select the rotation error of J2.
|
if lf1 > 10000 then
|
|
CALL MotionSkip
|
'If the rotation error of J2 exceeds 10000 (in pulses),
'then abort motion commands and end the loop.
|
EXIT DO
|
|
endif
|
|
CALL MotionComp(comp)
|
|
LOOP UNTIL comp=1
|
'Loop until the end of motion commands.
|