Robot

From SweepMe! Wiki
Revision as of 23:04, 28 October 2021 by Afischer (talk | contribs)
Jump to navigation Jump to 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 = {
            "x":{
                "Value": 0.0
                },
            "y":{
                "Value": 300.0
                },
            "z":{
                "Value": 0.0
                },
            "tool":{
                "Value": 0.0
                },
            }


    def __init__(self):              
       EmptyDevice.__init__(self)
    
    def apply(self):
        print(self.sweepvalues)

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.