robots.resources package

robots.resources.lock module

robots.resources.lock.lock(res, wait=True)[source]

Used to define which resources are acquired (and locked) by the action.

This decorator may be used as many times as required on the same function to lock several resources.

Usage example:

L_ARM = Resource()
R_ARM = Resource()
ARMS = CompoundResource(L_ARM, R_ARM)

def lift_box(robot):

def wave_hand(robot):

@lock(L_ARM, wait=False)
def scratch_head(robot):

robot.wave_hand() # waits until lift_box is over
robot.scratch_head() # skipped if lift_box or
                    # wave_hand are still running
  • res – an instance of Resource or CompoundResource
  • wait – (default: true) if true, the action will wait until the resource is available, if false, the action is skipped if the resource is not available.

robots.resources.resources module

class robots.resources.resources.CompoundResource(*args, **kwargs)[source]
acquire(wait=True, acquirer='unknown')[source]
class robots.resources.resources.Resource(name='')[source]
acquire(wait=True, acquirer='unknown')[source]