From SweepMe! Wiki
Jump to: navigation, search

The Robot module is designed to support multi-axes machines, i.e. robots. It can load drivers which can bringe their own parameters, similar to modules like Logger or Switch. A specialty is that each driver can define multiple axes. The sweep value of each axis is forwarded to the driver during apply function.

Driver programming

Each driver needs a static variable 'axes' which is a dictionary whose keys define the possible axes:

from EmptyDeviceClass import EmptyDevice  # Loading the EmptyDevice Class

class Device(EmptyDevice):            # Creating a new Device Class by inheriting from EmptyDevice

    axes = {
                "Value": 0.0
                "Value": 300.0
                "Value": 0.0
                "Value": 0.0

    def __init__(self):              
    def apply(self):
        print(self.sweepvalues)  # a dictionary containing the new sweep values for all axes if not None or float('nan')

    def go_home(self):
        print("go home")  # use this function to go to the reference position

For each axis, a further dictionary is defined that can contain further properties, e.g "Value", that defines the default value.

During the function apply, a dictionary 'self.sweepvalues' contains the values of each axis with keys being the axes names. The dictionary only containes values if they are not None or float('nan')

To support the "Go home" button, each driver needs a "go_home" method where one has to add the commands to performe a move to the reference position. The functions connect and disconnect are automatically called by the module.