Spinnaker Camera Error

36 views
Skip to first unread message

Jack Sullivan

unread,
Jun 5, 2024, 10:27:29 AMJun 5
to the labscript suite
Hi everyone,

I'm currently a beginner with Labscript, and I'm trying to learn more about how to control cameras. Right now I am using a Grasshopper 3 camera from FLIR (originally bought from PointGrey), and using Spinnaker. I got everything working fine in SpinView, and the camera is recognized by BLACS. However, when I try to manually take a snapshot, I get the following error:

Traceback (most recent call last):
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\labscript_devices\IMAQdxCamera\blacs_workers.py", line 323, in snap
    image = self.camera.snap()
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\labscript_devices\SpinnakerCamera\blacs_workers.py", line 148, in snap
    self.configure_acquisition(continuous=False, bufferCount=1)
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\labscript_devices\SpinnakerCamera\blacs_workers.py", line 201, in configure_acquisition
    self.set_stream_attribute('StreamBufferCountMode', 'Auto')
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\labscript_devices\SpinnakerCamera\blacs_workers.py", line 110, in set_stream_attribute
    self.set_attribute(name, value, stream_map=True)
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\labscript_devices\SpinnakerCamera\blacs_workers.py", line 130, in set_attribute
    PySpin.CValuePtr(node).FromString(value)
  File "C:\Users\labscript-suite\labscript_env\lib\site-packages\PySpin\PySpin.py", line 10467, in FromString
    return _PySpin.CValuePtr_FromString(self, ValueStr, Verify)
_PySpin.SpinnakerException: Spinnaker: GenICam::InvalidArgumentException= Feature 'StreamBufferCountMode' : cannot convert value 'Auto', the value is invalid. : InvalidArgumentException thrown in node 'StreamBufferCountMode' while calling 'StreamBufferCountMode.FromString()' (file 'Enumeration.cpp', line 132) [-2001]

I'm not sure why this is exactly and was wondering if anyone else has had a similar issue. I'm also still learning about how the triggers and parent devices work, but I was thinking that in manual mode none of that would really matter.

Thanks!


Jack Sullivan

unread,
Jun 5, 2024, 11:31:37 AMJun 5
to the labscript suite
I was actually able to fix this issue on my own. It seems that when taking a single snap, Labscript sets the StreamBufferCountMode to 'Auto'. However, this feature was depreciated by the SpinnakerSDK some time ago (https://www.flir.com/support-center/iis/machine-vision/knowledge-base/spinnaker-sdk-release-notes/). 

To fix this, I went into <path>\labscript_devices\SpinnakerCamera\blacs_workers.py, and then to the function 'configure_acquisition' on line 186. Within this function, in the else if statement, I removed the line:
 self.set_stream_attribute('StreamBufferCountMode', 'Auto')

and replaced it with the lines: 

self.set_stream_attribute('StreamBufferCountMode', 'Manual')
self.set_stream_attribute('StreamBufferCountManual', 3)

This turns the buffer mode to manual just like the continuous video version. I manually set the amount of buffers to 3, since on the SpinnakerSDK documention they mentioned that is the minimum number of buffers. After this, everything worked fine.

Philip Starkey

unread,
Jun 15, 2024, 10:41:37 AMJun 15
to the labscript suite
Hi Jack,

Glad you got it working! This sounds like a bug that should be fixed. Would you be interested in contributing a fix by opening a pull request on GitHub with the changes?

Cheers,
Phil

Reply all
Reply to author
Forward
0 new messages