Hello all, 

I am in the process of adding remote robotic control to an all-sky camera designed by a previous team of students at my university. My goal is to operate the camera and its filterwheel (which previously could only be adjusted by hand) completely remotely for several days. The camera used is a QHY MiniCam5F with a fisheye lens for horizon-to-horizon viewing. I'm aware that this camera has an automatic filterwheel built into it, but we don't have filters which fit into it, so we are not using it and sticking to a larger external one. For more details on the setup I've attached a diagram. 

To operate the camera remotely I am using Astroberry and the VNC viewer function (there will be a WiFi connection at the observation point). The filterwheel is turned using a stepper motor which I have programmed in Python. I would like to operate both the camera and the stepper motor from the same Python file - this way, I can time the turning of the filterwheel with the camera capturing an image, so that they are in sync and I don't accidentally just capture the dividers between the filters all night!

I have been trying to implement the KStars DBUS interface to accomplish this. So far all is well, except I cannot figure out how to save my captures to the Raspberry Pi! I have borrowed the large part of my code for the DBUS parts of my script from the very helpful example by Jasem Mutlaq, and I am able to preview the captured image using the KStars FITS viewer which automatically pops up when I run the getBLOBFile() command, but I cannot for the life of me figure out how to then save it permanently. I have included the relevant snippet of the script below (if you would like to see the rest of the file, I have attached it as well):

exposure_time = 5
print ("Taking a " + str(exposure_time) + "  second CCD exposure...")
# Take 5 second exposure
iface.setNumber("QHY CCD MINICAM5S-M-60e", "CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", exposure_time)
iface.sendProperty("QHY CCD MINICAM5S-M-60e", "CCD_EXPOSURE")
# Wait until exposure is done
ccdState       = "Busy"
while True:
    ccdState = iface.getPropertyState("QHY CCD MINICAM5S-M-60e", "CCD_EXPOSURE")
    if (ccdState != "Ok"):
         print("Waiting... CCD state is " + str(ccdState))
         time.sleep(2)
    else:
         break
fileinfo = iface.getBLOBFile("QHY CCD MINICAM5S-M-60e", "CCD1", "CCD1")
print("Exposure " + str(i) + " complete.")
print("We received file: ", fileinfo[0], " with format ", fileinfo[1], " and size ", fileinfo[2])
command = "fv " + fileinfo[0]
os.system(command)
time.sleep(1)

I am sure my confusion stems from my lack of familiarity with DBUS interfacing. Here's what I've figured out so far but am still confused by:
1. fileinfo[0] contains a dbus.Array, which I think is the data for the file, stored as a BLOB object. I have tried to decode this data in save it to a FITS file several ways without success, I think I fundamentally don't understand how the data is being represented in this file. 
2. I know that the capture is being stored in a temporary file, which is how I can view it with the KStars FITS viewer. I can manually save the data to a FITS file using the viewer, but this is not practical as I want the camera to run independently for several hours. How can I find, copy and save this temporary file from my Python script?

Please let me know if clarification is necessary. Thank you!
 

Read More...