×

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

Bi-monthly release with minor bug fixes and improvements

Capture and save image with Indi DBUS - Help!

  • Posts: 1
  • Thank you received: 1
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!
 
The following user(s) said Thank You: Jasem Mutlaq
2 years 3 months ago #79035
Attachments:

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

Hello Emily and welcome to INDI forums! Very nice project you've got there! As you found out from the DBus tutorial , getBLOBFile gets the file information and not the data itself. Since you have the filepath in fileinfo[0], you can simply copy the file to where ever you want. e.g.

os.system("cp " + fileinfo[0] + " /path/directory/newfile.fits")
The following user(s) said Thank You: Emily Humble
2 years 3 months ago #79042

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

  • Posts: 1
  • Thank you received: 1
Jasem - thanks so much for your quick reply. 

No luck with that suggestion unfortunately. I am getting passed an empty file name by the getBLOBFile() function. I ran the example script indibus.py with the CCD and Telescope simulators included on the DBUS tutorial page to see if the issue came from something I changed accidentally in my script, but the example also returned an empty file name. Here is the output I get from indibus.py:

Waiting for INDI devices...
We received the following devices:
Telescope Simulator
CCD Simulator
Establishing connection to Telescope and CCD...
Connected to Telescope and CCD is established.
Commanding telescope to slew to coordinates of star Caph...
Telescope slew is complete, tracking...
Taking a 5 second CCD exposure...
Exposure complete
We received file:    with format    and size  0

Must be something in the way I've set up the relationship between the DBUS and Ekos... any thoughts?

Thank you!
 
2 years 3 months ago #79060

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

Actually my bad. Right it doesn't work but I remember now why. Ekos transitioned from file-based BLOBs to in-memory BLOBs so that's why there is no physical file. I think your best bet is to use a dedicated client like PyINDI for this purpose.
The following user(s) said Thank You: Emily Humble
2 years 3 months ago #79068

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

Time to create page: 0.192 seconds