Hello, I'm new here and I'm trying to develop software to control an sbig camera STF-8300C, when I try to take an image it seem that the newBLOBmethod from the IndiClient class is not being called so at the end I'm not getting an image. I would appreciate it if you could give me a hint about what I'm doing wrong.
And this is the class I have for the sbig, the function I'm using is obtain_img()
class SBIG():
"""Class for an SBIG camera.
Methods
set_temp : change the temperature of the ccd chip
start : Initializes the connections to the indiserver
obtain_img : obtains any type of image from the ccd
"""
def __init__(self, typ, depth, default_temp=None):
""" Control object for a camera chip or sensor (e.g. CCD).
Parameters
ccd : str
The device, the indiclient is conecting to (default is "SBIG CCD")
default_temp : int (default is -10)
"""
def start(self, server="indi_sbig_ccd"):
"""start the indiserver for the SBIG and connect to it"""
r = start_dev(self, server)#returns 0 if indiserver connection is successful
if r:
return r
if not self.run:
logging.info('SBIG camera not running!')
return 1
def obtain_img(self):
"""Take an image with the SBIG CCD camera"""
#now we want to take an image with the ccd camera
self.ccd_exposure = self.device.getNumber("CCD_EXPOSURE") #Expose the CCD chip for CCD_EXPOSURE_VALUE seconds
while not self.ccd_exposure:
time.sleep(0.5)
self.ccd_exposure = self.device.getNumber("CCD_EXPOSURE")
print(f"CCD exposure set to:{self.ccd_exposure[0].value}")#by default set to 1 second
# Ensure the CCD simulator snoops the telescope
# otherwise you may not have a picture
self.ccd_active_devices = self.device.getText("ACTIVE_DEVICES")
while not(self.ccd_active_devices):
time.sleep(0.5)
self.ccd_active_devices=self.device.getText("ACTIVE_DEVICES")
self.ccd_active_devices[0].text="indi_lx200_10micron"
self.indiclient.sendNewText(self.ccd_active_devices)
#print(f"active devices inside CCD camera: {self.ccd_active_devices[0].text}")
# we should inform the indi server that we want to receive the
# "CCD1" blob from this device
self.indiclient.setBLOBMode(PyIndi.B_ALSO, self.typ, "CCD1")#BLOB property: BLOB is a Binary Large OBject used to transfer binary data to and from drivers.
ccd_ccd1=self.device.getBLOB("CCD1")
while not(ccd_ccd1):
time.sleep(0.5)
ccd_ccd1=self.device.getBLOB("CCD1")
print('I got BLOB property',ccd_ccd1[0].name)
# a list of our exposure times
exposures=[1.0, 5.0]
# we use here the threading.Event facility of Python
# we define an event for newBlob event
global blobEvent
blobEvent=threading.Event()
blobEvent.clear()
i=0
self.ccd_exposure[0].value=exposures
print('defining ccd exposures after creating threading event')
#let's try to take a single exposure
self.indiclient.sendNewNumber(self.ccd_exposure)
print("Exposure time sent:",self.ccd_exposure[0].value)
while (i < len(exposures)):
# wait for the ith exposure
blobEvent.wait()
print('I am after blobevent wait')
# we can start immediately the next one
if (i + 1 < len(exposures)):
self.ccd_exposure[0].value=exposures[i+1]
blobEvent.clear()
self.indiclient.sendNewNumber(self.ccd_exposure)
print('I just sended newNumber property to set exposure time')
# and meanwhile process the received one
for blob in ccd_ccd1:
print("name: ", blob.name," size: ", blob.size," format: ", blob.format)
# pyindi-client adds a getblobdata() method to IBLOB item
# for accessing the contents of the blob, which is a bytearray in Python
img=blob.getblobdata()
#print("fits data type: ", type(img))
print("len img data :", len(img))#should not be 0
i+=1
I'm printing messages and I see that I never get the message "Entering NewBLOB", this is why I think that the method is not being triggered for some reason. I'm a bit stuck here and I don't know what to try now. Thanks!