Hello all,

I'm implementing a software in Python to perform automatic observations, it runs everyday via cron job. I noticed that an error occurs when connecting to the indiservers, and it is not reproducible. I don't understand really well why it's happening. And when the error is raised, the mount doesn't move or points to the wrong coordinates. This is the message that is being printed:

Connect new device 10micron
Dispatch command error(-1): INDI: Could not find property MINIMAL_NEW_ALIGNMENT_POINT_RO in 10micron
<setNumberVector device="10micron" name="MINIMAL_NEW_ALIGNMENT_POINT_RO" state="Idle" timeout="60" timestamp="2023-12-07T21:56:21">
<oneNumber name="MRA">
19.810110092163085938
</oneNumber>
<oneNumber name="MDEC">
88.2845001220703125
</oneNumber>
<oneNumber name="MSIDE">
0
</oneNumber>
<oneNumber name="SIDTIME">
1.8413222222222223046
</oneNumber>
</setNumberVector>
Connect new device SBIG CCD

or this for the dome:

Connect new device Baader Dome
Dispatch command error(-1): Device Baader Dome not found
<setSwitchVector device="Baader Dome" name="DOME_FLAP" state="Ok" timeout="60" timestamp="2024-03-04T15:21:49">
<oneSwitch name="FLAP_OPEN">
Off
</oneSwitch>
<oneSwitch name="FLAP_CLOSE">
On
</oneSwitch>
</setSwitchVector>

I don't know where this error is being generated to catch it, and restart the indiserver connection, or even resetting the mount is what fixes the problem. I need to find this error in my code to make the system completely automatic. This was my attempt to see this error, but I haven't managed to reproduce it:

class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, self).__init__()
def newDevice(self, d):
try:
logging.info("Connect new device " + d.getDeviceName())
self.device = d
except:
print("Error alignment found")
raise Exception("Dispatch command error")
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
blobEvent=threading.Event()
blobEvent.clear()
print("new BLOB ", bp.name)
#blobEvent.set()
print("name: ", bp.name," size: ", bp.size," format: ", bp.format)

img = bp.getblobdata()
blobfile = io.BytesIO(img)#buffer containing the data
hdu_list = fits.open(blobfile)#we give a memory buffer instead of a file
img_data = hdu_list[0].data
fits.writeto('img_test_%s.fits'%i,img_data,header=hdu_list[0].header,overwrite=True)
#print('img data type:',type(img_data))
pass
#def process_img(self,img):
# blobfile = io.BytesIO(img)
# hdu_list = fits.open(blobfile)
# img_data = hdu_list[0].data
# i = 0
# fits.writeto('img_test_%s.fits'%i,img_data,header=hdu_list[0].header,overwrite=True)
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)

I guess that the error is being raised after a newDevice has been connected, but I'm not sure. I would appreciate it if you could guide me on this. Thanks in advance.

Read More...

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!


Read More...