Robot: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
Line 39: Line 39:
For each axis, a further dictionary is defined that can contain further properties, e.g "Value", that defines the default value.
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.
During the function [[apply]], a dictionary 'self.sweepvalues' contains the values of each axis with keys being the axes names.




[[Category:Modules]]
[[Category:Modules]]
[[Category:Device Modules]]
[[Category:Device Modules]]

Revision as of 22:04, 28 October 2021

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.