ID : 5112
Program Example
A program example is shown below.
Program Example Description
-
The collision detection function can set multiple tables.
In the following example, multiple configured tables are used to enable the collision detection function as a whole and use only particular parts with a detection sensitivity increased.
-
Use the SetCollisionDetection command to set tables for a whole operation and tables for a particular operation.
Before starting a whole operation, use the CollisionDetection command to enable tables for a whole operation.
Before a particular operation, enable tables for a particular operation.After finishing a particular operation, use the "CollisionDetection" command to disable tables for a particular operation.
Finally, use the GetCollisionStatus command to verify the collision detection status. If a collision exists, evacuate. - However, if the robot is actually used, use "GetCollisionStatus" with the supervisory task or another task to monitor the collision status and perform avoidance operations such as a saving operation or stopping the robot each time.
Example
Sub Main 'Start the program.
'Collision detection for a whole operation (table 1, robot axis, no error output)
SetCollisionDetection 1, &h3f, J(100,100,100,100,100,100), 1
'Collision detection for a pick (table 2, robot axis, error output)
SetCollisionDetection 2, &h3f, J(100,50,50,100,50,100), 0
TakeArm 0
Extspeed 80
Speedmode 3
Motor ON
Move P,@0 P1
'Enable tables for a whole operation.
CollisionDetection True, 1
'Pick & place operation
'Target point up in the sky
Approach L, P2, 100
'Pick operation
'Enable tables for a particular operation and increase the detection sensitivity.
CollisionDetection True, 2
Move L,@0 P2, Speed = 10
Depart L, 100
'Finish the collision detection for a particular operation.
CollisionDetection False, 2
:
:
'Finish the collision detection for a whole operation.
CollisionDetection False, 1
'Verify the collision status.
I1 = GetCollisionStatus(1)
If Not I1 = 0 Then Goto ErrProc
ExitProc:
Exit Sub
ErrProc:
'Error handling
S0 = "Collision detected. Verify the work."
End Sub 'End of program.
ID : 5112