25.2
Move multiple robots

Move multiple robots

Wandelscript supports moving more than one robot simultaneously. This function is called multi-robot support.

Within a cell, multiple robots can be controlled by a single program and be moved simultaneously with do with <controller[id]>: and and do with <controller[id]>. and do acts as an implicit sync. Every block starting with and do will be executed simultaneously to the first block do. The robot within this block will be considered the master robot.

In this example, the robot cell contains two controllers, ur10e and ur5e, each having one robot with the id 0. Each of the robots has a tool attached, tcp10 and tcp5.

tcp10 = frame("tcp10")
tcp5 = frame("tcp5")
do with ur10e[0]:
    with velocity(301):
        move tcp10 via p2p() to (150, -355, 389, 0, pi, 0)
        move tcp10 via p2p() to (150, -355, 489, 0, pi, 0)
and do with ur5e[0]:
    with velocity(101):
        move tcp5 via p2p() to (-95, -363, 387, 0, pi, 0)
        move tcp5 via p2p() to (-95, -363, 387, pi, 0, 0)

a = read(ur10e, 'tcp10')
print('+================================================')
print(a)

Within one robot context (starting with do with <controller[id]>:), neither explicit nor implicit sync between movement commands are currently supported. The implicit sync happens after the next robot context (starting with and) block was executed. Each robot context has its own motion pointer which then gets synchronized with the program pointer. a will be read only after both robots have stopped moving.

When and is omitted, ur10e[0] only starts moving after ur5e[0] has completed its movement. a will be read directly after ur5e[0] has started moving.

tcp10 = frame("tcp10")
tcp5 = frame("tcp5")
do with ur10e[0]:
    move tcp10 via p2p() to (150, -355, 389, 0, pi, 0)
    move tcp10 via p2p() to (150, -355, 489, 0, pi, 0)
do with ur5e[0]:
    move tcp5 via p2p() to (-95, -363, 387, 0, pi, 0)
    move tcp5 via p2p() to (-95, -363, 387, pi, 0, 0)

a = read(ur10e[0], 'tcp10')
print('+================================================')
print(a)
ℹ️

Try out our complex multi-robot Wandelscript examples and move 3 robots simultaneously.

Robot context restrictions

Robot contexts can only be used to describe robot movements via move commands as explicit and implicit syncs are not supported within a robot context.

do with, a robot context, and the end of a script cause implicit syncs and can therefore not be used within a robot context. If you're using the Robot pad and an implicit sync is caused within a robot context, the NestedSyncError will be displayed.