Robot: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
(Created page with "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 [Switc...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
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].
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.
A specialty is that each driver can define multiple axes. The sweep value of each axis is forwarded to the driver during [[apply]] function.




Line 31: Line 31:
       EmptyDevice.__init__(self)
       EmptyDevice.__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.
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. 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.


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

Latest revision as of 22:11, 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)  # 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.