|
| 1 | + |
| 2 | +from typing import Union, List, Dict |
1 | 3 | from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun,
|
2 | 4 | main, DataActuatorType, DataActuator)
|
3 | 5 |
|
@@ -37,12 +39,14 @@ class DAQ_Move_Template(DAQ_Move_base):
|
37 | 39 | # TODO add your particular attributes here if any
|
38 | 40 |
|
39 | 41 | """
|
40 |
| - _controller_units = 'whatever' # TODO for your plugin: put the correct unit here |
41 | 42 | is_multiaxes = False # TODO for your plugin set to True if this plugin is controlled for a multiaxis controller
|
42 |
| - _axis_names = ['Axis1', 'Axis2'] # TODO for your plugin: complete the list |
43 |
| - _epsilon = 0.1 # TODO replace this by a value that is correct depending on your controller |
| 43 | + _axis_names: Union[List[str], Dict[str, int]] = ['Axis1', 'Axis2'] # TODO for your plugin: complete the list |
| 44 | + _controller_units: Union[str, List[str]] = 'mm' # TODO for your plugin: put the correct unit here, it could be |
| 45 | + # TODO a single str (the same one is applied to all axes) or a list of str (as much as the number of axes) |
| 46 | + _epsilon: Union[float, List[float]] = 0.1 # TODO replace this by a value that is correct depending on your controller |
| 47 | + # TODO it could be a single float of a list of float (as much as the number of axes) |
44 | 48 | data_actuator_type = DataActuatorType.DataActuator # wether you use the new data style for actuator otherwise set this
|
45 |
| - # as DataActuatorType['float'] (or entirely remove the line) |
| 49 | + # as DataActuatorType.float (or entirely remove the line) |
46 | 50 |
|
47 | 51 | params = [ # TODO for your custom plugin: elements to be added here as dicts in order to control your custom stage
|
48 | 52 | ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
|
@@ -85,7 +89,13 @@ def commit_settings(self, param: Parameter):
|
85 | 89 | A given parameter (within detector_settings) whose value has been changed by the user
|
86 | 90 | """
|
87 | 91 | ## TODO for your custom plugin
|
88 |
| - if param.name() == "a_parameter_you've_added_in_self.params": |
| 92 | + if param.name() == 'axis': |
| 93 | + self.axis_unit = self.controller.your_method_to_get_correct_axis_unit() |
| 94 | + # do this only if you can and if the units are not known beforehand, for instance |
| 95 | + # if the motors connected to the controller are of different type (mm, µm, nm, , etc...) |
| 96 | + # see BrushlessDCMotor from the thorlabs plugin for an exemple |
| 97 | + |
| 98 | + elif param.name() == "a_parameter_you've_added_in_self.params": |
89 | 99 | self.controller.your_method_to_apply_this_param_change()
|
90 | 100 | else:
|
91 | 101 | pass
|
|
0 commit comments