handles multiaxis at startup without knowing beforehand#22
Conversation
rgeneaux
left a comment
There was a problem hiding this comment.
I don't have the available PI hardware to test right now but this looks nice, I didn't understand that the self.axis_names and _units were setters for the Parameters, this is practical!
But I could test this on a smaract controller with 4 axes, with the same logic. It works well in a daq_move, but there is a slight issue when launching from a preset because the parametertree doesn't show the correct selected axis once loaded.
I could fix it like that during the ini_stage (my plugin uses dicts instead of lists but it doesn't matter):
axis_parameter = self.settings.child("multiaxes","axis")
current_axis = axis_parameter.value() #If we are loading from a preset, some non-default value might be here
self.axis_names = dict(zip(names, range(self.controller.get_number_of_channels()))) # Set limits of axis parameter
axis_parameter.setValue(current_axis) # Set to preset value
axis_parameter.sigValueChanged.emit(axis_parameter, axis_parameter.value()) # Trigger UI change
Perhaps there is a better way of doing it - using the @axis_name.setter perhaps? also maybe QtWidgets.QApplication.processEvents() instead of triggering manually the sigvaluechanged?
|
yes axis_name setter is the way to do it. However I used this on a three axis PI stage with a preset where all axes where set manually and I got it working ok! |
|
Regarding the PI plugin, I was only able to test that your version works well for single-axis controller (what I have). If nobody else can test it on a multi-axis one let's accept the PR! |
No description provided.