×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Taking image with CCD SBIG camera, newBLOB method is not being called

  • Posts: 2
  • Thank you received: 0
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.

This is the IndiClient class I'm using:

class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, self).__init__()
def newDevice(self, d):
logging.info("Connect new device " + d.getDeviceName())
self.device = d
def newProperty(self, p):
Type = ("number", "switch", "text", "light", "blob", "xxx5", "xxx6")
tsp = (" ", " ", " ", " ", " ", " ", " ")
logging.debug("New " + Type[p.getType()] + tsp[p.getType()] + p.getName() + " for device "+ p.getDeviceName())
pass
def removeProperty(self, p):
logging.debug("Remove property " + p.getName() + " for device " + p.getDeviceName())
pass
def newBLOB(self, bp):
print('Entering NewBLOB')
global blobEvent #test if this is causing problems
print("new BLOB ", bp.name)
blobEvent.set()
pass
def newSwitch(self, svp):
pass
def newNumber(self, nvp):
pass
def newText(self, tvp):
pass
def newLight(self, lvp):
pass
def newMessage(self, d, m):
pass
def serverConnected(self):
pass
def serverDisconnected(self, code):
pass
def disconnectServer(self):
return PyIndi.BaseClient.disconnectServer(self)


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)
"""

self.typ = typ
self.device = None
self.run = False
self.connection = False
self.indiclient = None
self.server_running = False
self.default_temp = default_temp
self.busy = False

self.ccd_exposure = None
self.ccd_active_devices = None
self.ccd_temperature = None
self.ccd_frametype = None
self.depth = depth

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!
7 months 3 weeks ago #95412

Please Log in or Create an account to join the conversation.

  • Posts: 262
  • Thank you received: 66
The newBLOB() method is no longer called as of INDI 2.0.0.

Here is a thread I opened on this topic:
github.com/indilib/pyindi-client/issues/32
The following user(s) said Thank You: Jasem Mutlaq
7 months 3 weeks ago #95428

Please Log in or Create an account to join the conversation.

Time to create page: 0.290 seconds