Robot
The Robot module is designed to support multi-axis machines, i.e. robots. It can load drivers which can bring their own parameters, similar to modules like Logger or Switch. A specialty is that each driver can define multiple axes. The value of each axis is forwarded to the driver during the apply() function.
Usage
- Driver and Port: select the driver and the port of your robot. The field "Channel" is only shown if the driver defines channels.
- Axes: the table lists the axes defined by the driver. Enter the target value of each axis in the column "Value". The values can use the parameter syntax {...}, e.g. to take positions from a TableValues module.
- Apply: sends the current values of all axes to the robot, e.g. to test the driver or to adjust the setup.
- Go home: moves the robot to its reference position. The button is disabled during a run.
- Options: "Go home at start" and "Go home at end", if supported by the driver.
- Parameters: further fields defined by the driver.
Driver programming
Each driver needs a class attribute 'axes' which is a dictionary whose keys define the possible axes:
from pysweepme.EmptyDeviceClass import EmptyDevice
class Device(EmptyDevice):
axes = {
"x": {"Value": 0.0},
"y": {"Value": 300.0},
"z": {"Value": 0.0},
"tool": {"Value": 0.0},
}
def __init__(self) -> None:
super().__init__()
def apply(self) -> None:
print(self.sweepvalues) # dictionary with the new values of all axes that are not None or float('nan')
def go_home(self) -> None:
print("go home") # add the commands to move 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 shown in the Axes table.
During the function apply(), the dictionary 'self.sweepvalues' contains the values of each axis with keys being the axes names. The dictionary only contains values that are not None or float('nan'). Convert the values to the type you need, e.g. with float().
To support the "Go home" button, each driver needs a "go_home" method where one has to add the commands to perform a move to the reference position. The button calls the functions connect(), go_home and disconnect().
GUI Parameters
The following GUI parameters are supported:
- GoHomeStart:
bool, activates the Go home at start checkbox. The driver has to perform the move itself, e.g. by calling go_home in initialize(). - GoHomeEnd:
bool, activates the Go home at end checkbox. The driver has to perform the move itself, e.g. by calling go_home in deinitialize().
The axes are not a GUI parameter but are defined by the class attribute axes. All additional parameters defined in the driver are displayed in the section 'Parameters'.