ID : 2017
Programming
Programming Example
This section shows sample program of the cooperative control function.
Description of Each Program
MainPro.pcs
This is a main program of cooperative control function. At the beginning of the program, execute initialization, and then, asynchronously execute programs for the motion of master and that of for slaves. And then, execute programs for the cooperative control function.
InitRobots.pcs
With this program, set the base coordinates on the master and slave as a initialization process.
Robot0Pro.pcs
This program moves Robot0 (master) to a motion position. Since "Robot0" has been set to the default robot, you can write a command without specifying "Robot0".
Robot1Pro.pcs
This program moves Robot1 (slave) to a motion position. Since "Robot1" has been set to the default robot, you can write a command without specifying "Robot1".
CoopRobotPro.pcs
This is a program for the cooperative control function.
Set the tool coordinate and work coordinate, and then execute synchronous motion first. Grip a work piece and then execute cooperative motion.
<MainPro.pcs>
'!TITLE "Sample program for operations with multiple robots"
#Include "InitRobots.pcs"
Sub Main
Call InitRobots 'Initialize Robot0 and Robot1
Run Robot0Pro 'Motion program of Robot0
Run Robot1Pro 'Motion program of Robot1
Wait Not( Status( Robot0Pro ) = 3 ) 'Wait until motion program of Robot0 ends.
Wait Not( Status( Robot1Pro ) = 3 ) 'Wait until motion program of Robot1 ends.
Run CoopRobotPro 'Motion program of Robot0 and Robot1
End Sub
<InitRobots.pcs>
'!TITLE "Initialize Robot0 and Robot1"
Sub Main
Robot0.TakeArm 'Obtain the control of Robot0
Robot1.TakeArm 'Obtain the control of Robot1
'Set the robot positions (face each other with 800mm apart)
Robot0.Base P( 0, 400, 0, 0, 0, -90 ) 'Change the base coordinate of Robot0
Robot1.Base P( 0, -400, 0, 0, 0, 90 ) 'Change the base coordinate of Robot1
Robot0.GiveArm 'Release the control of Robot0
Robot1.GiveArm 'Release the control of Robot1
End Sub
<Robot0Pro.pcs>
'!TITLE "Motion program of Robot0
Sub Main
'P1,P2,P3 :Motion point of Robot0
#Pragma Optimize( "DefaultRobot", 0 ) 'Set Robot0 to the default robot
TakeArm 0 'Obtain the control of Robot0
Move P, @e P1 'Move Robot0 to P1
Move P, @e P2 'Move Robot0 to P2
Move P, @e P3 'Move Robot0 to P3
End Sub
<Robot1Pro.pcs>
'!TITLE "Motion program of Robot1
Sub Main
'P11,P12 :Motion point of Robot1
#Pragma Optimize( "DefaultRobot", 1 ) 'Set Robot1 to the default robot
TakeArm 0 'Obtain the control of Robot1
Move P, @e P11 'Move Robot1 to P11
Move P, @e P12 'Move Robot1 to P12
End Sub
<CoopRobotPro.pcs>
'!TITLE "Motion program of Robot0 and Robot1
Sub Main
'Teaching point of the master robot: P21, P23, P24
'Teaching point of the slave robot: P22
Robot0.TakeArm 'Obtain the control of Robot0
Robot1.TakeArm 'Obtain the control of Robot1
Robot0.ChangeTool 1 'Change the tool coordinates of Robot0
Robot1.ChangeTool 1 'Change the tool coordinates of Robot1
Robot0.ChangeWork 1 'Change the work coordinates of Robot0
Robot1.ChangeWork 1 'Change the work coordinates of Robot1
'Mote Robot0 and Robot1 to the positions that are 50mm away from each operation position
SyncTime ( Robot0.Approach P, P21, 50 ),_
( Robot1.Approach P, P22, 50 ), Next
'Move Robot0 and Robot1 to each operation position
SyncTime ( Robot0.Move L, @e P21, Speed = 20 ),_
( Robot1.Move L, @e P22, Speed = 20 )
'Grip a work piece
Robot0.SetHandIO 64, 1, 1 'Turn ON Hand I/O number 64 on Robot0
Robot1.SetHandIO 64, 1, 1 'Turn ON Hand I/O number 64 on Robot1
Delay 100
'Cooperative motion
'Robot1 automatically moves along with the motion of Robot0
Robot0.Move L, P23, Speed = 20, syncmove = Robot1
Robot0.Move L, P24, syncmove = Robot1
End Sub
ID : 2017