microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
35 stars 26 forks source link

Red pitaya dsp piezo issue. #874

Closed iandobbie closed 10 months ago

iandobbie commented 10 months ago

I am trying to get a test system running. This has a windows PC running cockpit, and a red pitaya executor as a dsp replacement.

Trying to add a simple piezo as a z stage I get the following error:

Traceback (most recent call last):
  File "C:\Users\idobbie1\src\cockpit\cockpit\__init__.py", line 162, in OnInit
    for device in self.Depot.initialize(depot_config):
  File "C:\Users\idobbie1\src\cockpit\cockpit\depot.py", line 169, in initialize
    self.initDevice(d)
  File "C:\Users\idobbie1\src\cockpit\cockpit\depot.py", line 257, in initDevice
    handlers = device.getHandlers()
  File "C:\Users\idobbie1\src\cockpit\cockpit\devices\stage.py", line 93, in getHandlers
    handler.connectToAnalogSource(aHandler, aline, offset, gain)
  File "C:\Users\idobbie1\src\cockpit\cockpit\handlers\stagePositioner.py", line 160, in connectToAnalogSource
    h = source.registerAnalog(self, line, offset, gain)
  File "C:\Users\idobbie1\src\cockpit\cockpit\handlers\executor.py", line 378, in registerAnalog
    h = AnalogLineHandler(client.name, self.name + ' analogs',
  File "C:\Users\idobbie1\src\cockpit\cockpit\handlers\executor.py", line 412, in __init__
    self.positions = []
  File "C:\Users\idobbie1\src\cockpit\cockpit\handlers\deviceHandler.py", line 146, in __setattr__
    self._publisher.publish(key, value)
AttributeError: 'AnalogLineHandler' object has no attribute '_publisher'

I will try to see what the root cause of this is.

iandobbie commented 10 months ago

The device is defined as AnalogLineHandler(GenericPositionerHandler) and this class is GenericPositionerHandler(deviceHandler.DeviceHandler). So at its base it is standard DeviceHandler but the init function doesn't call the super().init so the required infrastructure isn't created.

Adding a super().init appears to fix this issue and the system starts up.

I am trying to get the system together enough to run experiments to show this really works.

iandobbie commented 10 months ago

I think this is fixed