You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constraints management for newfocus pieze screws needs to be inline with best practice.
When does this occur?
Currently, the config is loaded and the constraints are set as class variables in on_activate.
Where on the platform does it happen?
In piezo_screws_newfocus.py on branch dev_newfocus_screws .
Expected behavior (i.e. solution)
Constraints should be loaded in get_constraints. A dictionary is returned here, which can then be made a class variable, ie something like this:
defon_activate(self):
""" Initialisation performed during activation of the module. @return: error code """# TODO: get these from configself.vendor_id=0x104dself.product_id=0x4000# find our deviceself.dev=usb.core.find(idVendor=self.vendor_id, idProduct=self.product_id)
# was it found?ifself.devisNone:
raiseValueError('Device not found')
return1# set the active configuration. With no arguments, the first# configuration will be the active oneself.dev.set_configuration()
# get an endpoint instancecfg=self.dev.get_active_configuration()
intf=cfg[(0,0)]
self.ep_out=usb.util.find_descriptor(
intf,
# match the first OUT endpointcustom_match=lambdae:
usb.util.endpoint_direction(e.bEndpointAddress) ==usb.util.ENDPOINT_OUT)
assertself.ep_outisnotNoneassertself.ep_out.wMaxPacketSize==64self.ep_in=usb.util.find_descriptor(
intf,
# match the first OUT endpointcustom_match=lambdae:
usb.util.endpoint_direction(e.bEndpointAddress) ==usb.util.ENDPOINT_IN)
assertself.ep_inisnotNoneassertself.ep_in.wMaxPacketSize==64self.constraints=self.get_constrains()
self._go_to_original_home()
return0
defget_constraints(self):
""" Retrieve the hardware constrains from the motor device. @return dict: dict with constraints for the sequence generation and GUI Provides all the constraints for the xyz stage and rot stage (like total movement, velocity, ...) Each constraint is a tuple of the form (min_value, max_value, stepsize) """# TODO: read this from configconstraints=OrderedDict()
axis0= {}
axis0['label'] ='x'axis0['channel'] =config['x']['channel']
axis0['pos_min'] =config['x']['constraints']['pos_min']
axis0['pos_max'] =config['x']['constraints']['pos_max']
axis1= {}
axis1['label'] ='y'axis1['channel'] =config['y']['channel']
axis1['pos_min'] =config['y']['constraints']['pos_min']
axis1['pos_max'] =config['y']['constraints']['pos_max']
axis2= {}
axis2['label'] ='z'axis2['channel'] =config['z']['channel']
axis2['pos_min'] =config['z']['constraints']['pos_min']
axis2['pos_max'] =config['z']['constraints']['pos_max']
# assign the parameter container for x to a name which will identify itconstraints[axis0['label']] =axis0constraints[axis1['label']] =axis1constraints[axis2['label']] =axis2returnconstraints
Other Comments
If required, a good example of this is in ntmdt_piezo_stage.py on branch dev_ntmdt_stage.
The text was updated successfully, but these errors were encountered:
Please also include example configuration - you can see an example of this in ntmdt_piezo_stage.py on branch dev_ntmdt_stage.
classPiezoStageNTMDT(Base, MotorInterface):
"""unstable: Matt van Breugel This is the hardware module for communicating with NT-MDT piezo scanning stages over USB (via the NovaSDK dll). It uses the VB script from the documentation. Example configuration: ``` # ntmdt_stage: # module.Class: 'motor.ntmdt_piezo_stage.PiezoStageNTMDT' # scanner: 1 # constraints: # x_range: # min: 0e-6 # max: 100e-6 # y_range: # min: 0e-6 # max: 100e-6 # z_range: # min: 0e-6 # max: 6e-6 ``` """_modclass='PiezoStageNTMDT'_modtype='hardware'
What is affected by this bug?
Constraints management for newfocus pieze screws needs to be inline with best practice.
When does this occur?
Currently, the config is loaded and the constraints are set as class variables in
on_activate
.Where on the platform does it happen?
In
piezo_screws_newfocus.py
on branchdev_newfocus_screws
.Expected behavior (i.e. solution)
Constraints should be loaded in
get_constraints
. A dictionary is returned here, which can then be made a class variable, ie something like this:Other Comments
If required, a good example of this is in
ntmdt_piezo_stage.py
on branchdev_ntmdt_stage
.The text was updated successfully, but these errors were encountered: