Thibault replied to the topic 'fully automated telescope control' in the forum. 1 month ago

First, I wanted to apologize for being late on working on this dbus scripting tutorial.
If you are interested in building your own python app to automate your observations, there are multiple choices of course, as you probably know, because you can either use pyIndi bindings, or dbus scripting.

In my case, I wanted to start on a pure pyIndi code, but I soon realized, that although it was very cool to use pyIndi to automate some acquisition/slew task, writing my own focuser or guider app, would have been quite a bit of work, and probably not as robust as already existing software.

I am now in the process of trying to see if it is possible to integrate easily my pyIndi code with debus scripting ekos functionalities (because ekos wants to run its own indi server it seems ?) and also because there is no interoperbility between pyIndi devices, and dbus scripting classes apparently (but I am not entirely sure though).

In terms of what you want to do, mabe you know that much more than I do, but in case, let me provide you with links to opensource code that people used for operating automated astronomy:

-A very cool wrapper for pyIndi devices:
github.com/GuLinux/indi-lite-tools/tree/...d76b/pyindi_sequence

-Use python native http astrometry client:
github.com/dstndstn/astrometry.net/tree/master/net/client

-wrap astrometry server in a docker that you can run on a more beefy machine:
github.com/dstndstn/nova-docker

-inspirational project for fully automated observatory, that implements nearly everything you need: astrometry, focusing, databases, scheduling,..., but guiding (as far as I know but it may be included):
github.com/panoptes/POCS

-very cool project that includes a 3D rendering engine based on pyqt5, to show what your (stl-modeled) telescope looks like
github.com/geehalel/npindi

I tried to mix up all these differents projects to have something fun to do, and maybe useful in the future, but I still have a long way to go. And deciding how to integrate ekos with dbus scripting is not necessarily an easy thing to do for me, as there are already multiple modules that I wrote (and don't want to get rid of, for now), and that are already there in Ekos.

In practice, the biggest obstacle I see with the dbus scripting approach, is that it might end-up just being a way to manipulate the interface, but not the underlying object with a good granularity (for instance, attaching callback upon blob reception, of stuff like this) that pyIndi does offer.
I still have to investigate dbus scripting more thoroughly, but all comments or answer, feeback on this are welcome.

Read More...

Thibault replied to the topic 'Losmandy Gemini 2 control with ethernet' in the forum. 1 month ago

I am also experiencing issues with lx200_gemini driver. Did you managed to get it working with indi ?

Read More...

Thibault replied to the topic 'FIXED: astrometry fails in Ekos and command line, used to work' in the forum. 1 month ago

I am also havin this issue with images generated by CCD Simulator. Does someone knows what happened here ?

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/dist-packages/astrometry/util/image2pnm.py", line 323, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/astrometry/util/image2pnm.py", line 320, in main
mydir, fix_sdss=options.fix_sdss)
File "/usr/lib/python2.7/dist-packages/astrometry/util/image2pnm.py", line 248, in convert_image
(imgtype, errstr) = image2pnm(infile, outfile, sanitized, force_ppm, no_fits2fits, extension, mydir, fix_sdss)
File "/usr/lib/python2.7/dist-packages/astrometry/util/image2pnm.py", line 184, in image2pnm
errstr = fits2fits(infile, sanitized, fix_idr=fix_sdss)
File "/usr/lib/python2.7/dist-packages/astrometry/util/fits2fits.py", line 86, in fits2fits
hdu.scale('int16', '', bscale, bzero)
File "/usr/lib/python2.7/dist-packages/astropy/io/fits/hdu/image.py", line 384, in scale
bzero=bzero, blank=None)
File "/usr/lib/python2.7/dist-packages/astropy/io/fits/hdu/image.py", line 442, in _scale_internal
self.data += -_zero
TypeError: Cannot cast ufunc add output from dtype('int32') to dtype('uint16') with casting rule 'same_kind'
augment-xylist.c:588:backtick Failed to run command: /usr/bin/python -m astrometry.util.image2pnm --sanitized-fits-outfile /tmp/tmp.sanitized.BRcXoK --fix-sdss --infile /[]/image00.fits --uncompressed-outfile /tmp/tmp.uncompressed.E1nqH3 --outfile /tmp/tmp.ppm.MGCTZm --ppm
ioutils.c:567:run_command_get_outputs Command failed: return value 1

Read More...

Thibault thanked Rob Lancaster in topic Xplanet 3 months ago
Thibault replied to the topic 'fully automated telescope control' in the forum. 4 months ago

Awesome !

Thank you very much Jasem for your commitment ! being able to use Ekos directly from scripts is my dream feature, (I started doing nice things with python bindings of Indi, but I really had to get my hands dirty to understand that I would never be able to build a software as powerful and an robust as Ekos on my own, even if I only need a subset of its features).

I will now switch to the dev version of KStars in order to be able to test the latest features to come

Read More...

Thibault replied to the topic 'fully automated telescope control' in the forum. 4 months ago

Yes, as I am currently exploring this topic, I can definitely try to write at least a small summary of the features accessible through DBus scripting.
Do you know where I should put that ? / in which format I should edit it ?

For now I see a few topics that can be interesting:

Indi DBus scripting
For now, I think the previous code allows to use basic INDI features through INDI DBus interface quite easily.

Scripting KStars, as a planetarium engine,through DBus
I did not tried to use this feature, as I try to rely on astropy to get ephemeride related data. but it could be interesting to show how to setup an observer position, time, and export a view in a script.
I did not saw where was the documentation for this, but it looks like Introspection already gives what's needed for a short example.

Using Ekos features through DBus
That is my main point of interest, and the module documentation here helps a lot: api.kde.org/extragear-api/edu-apidocs/kstars/html/modules.html
However, there are still things that I need to understand.

Question 1: Related to this page: api.kde.org/extragear-api/edu-apidocs/ks...osDBusInterface.html
I don't understand how to get this object through the bus, for me, the following code:

from pydbus import SessionBus
bus = SessionBus()
ekosmanager = bus.get("org.kde.kstars","/KStars/EkosManager")
Result in the following error:

GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: No such object path '/KStars/EkosManager


Apparently EkosManager does not exist ? However Ekos exist and doesn't looks like it is documented. ?

Question 2:
I managed to somehow start indi client, whithout needing to connect every Devices using INDIDBus interface thanks to something like this:
ekos = bus.get("org.kde.kstars","/KStars/Ekos")
ekos.connectDevices()
ekos.start()

However, I guess it worked only because there was a default profile already loaded somwhere (and I was able to set a specific existing profile thanks to ). But I don't know how to programaticaly create such profile.

Question 3:
I am working on setting up a fully automated focusing routine. I was surprised how easy it was to get something close to that (I'll share the code when it will work), with a few lines of DBus that starts with:
autofocuser = bus.get("org.kde.kstars","/KStars/Ekos/Focus")

However, there are manyy subteleties that I was not able to implement:
-Whenever I launched ekos.start(), how can I synchronize to the end of the startup, when the object is ready to handle submodule (focus, alignment, etc...)
-After setting up some parameters, and launching with autofocuser.start(), I would also like to be able to put a callback on every iterations to monitor HFR, and logs in my own app, and especially, be able to synchronize with the end of the process, how should I do ?
-It looks like many parameters from the GUI are not accessible through DBus (suspend guiding checkbox, number of frames,... )

Question 4:
When I press Ctrl+b, I was expecting to find all the content exposed in the DBus documentation. However, I only see KStars and SimClock module, is it normal ?

Thank you in advance for your help

Read More...

Thibault replied to the topic 'StarQuew - Web INDI client and sequence generator' in the forum. 4 months ago

Congratulation for this work !
I really liked your previous indi-based project github.com/GuLinux/indi-lite-tools , and took a lot of ideas from there to implement my own app.
I wish this project a long life :)

Read More...

Thibault replied to the topic 'fully automated telescope control' in the forum. 4 months ago

First things first, I upgraded and tested the DBus script to python3 + more recent python binding system for dbus scripting called pydbus (dbus python module is now obsolete):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gi.repository import GObject
from gi.repository import GLib
import os
import time

# Create a session bus.
from pydbus import SessionBus
bus = SessionBus()

# Create an object that will proxy for a particular remote object.
remote_object = bus.get("org.kde.kstars", # Connection name
                        "/KStars/INDI" # Object's path
                       )

# Introspection returns an XML document containing information
# about the methods supported by an interface.
print("Introspection data:")
print(remote_object.Introspect())

# Get INDI interface
myDevices = [ "indi_simulator_telescope", "indi_simulator_ccd" ]

# Start INDI devices
remote_object.start("7624", myDevices)

print("Waiting for INDI devices...")

# Create array for received devices
devices = []

while True:
    devices = remote_object.getDevices()
    if (len(devices) < len(myDevices)):
        time.sleep(1)
    else:
        break;

print("We received the following devices:")
for device in devices:
    print(device)

print("Establishing connection to Telescope and CCD...")

# Set connect switch to ON to connect the devices
remote_object.setSwitch("Telescope Simulator", "CONNECTION", "CONNECT", "On")
# Send the switch to INDI server so that it gets processed by the driver
remote_object.sendProperty("Telescope Simulator", "CONNECTION")
# Same thing for CCD Simulator
remote_object.setSwitch("CCD Simulator", "CONNECTION", "CONNECT", "On")
remote_object.sendProperty("CCD Simulator", "CONNECTION")

telescopeState = "Busy"
ccdState       = "Busy"

# Wait until devices are connected
while True:
    telescopeState = remote_object.getPropertyState("Telescope Simulator", "CONNECTION")
    ccdState       = remote_object.getPropertyState("CCD Simulator", "CONNECTION")
    if (telescopeState != "Ok" or ccdState != "Ok"):
        time.sleep(1)
    else:
        break

print("Connected to Telescope and CCD is established.")
print("Commanding telescope to slew to coordinates of star Caph...")

# Set Telescope RA,DEC coords in JNOW
remote_object.setNumber("Telescope Simulator", "EQUATORIAL_EOD_COORD", "RA", 0.166)
remote_object.setNumber("Telescope Simulator", "EQUATORIAL_EOD_COORD", "DEC", 59.239)
remote_object.sendProperty("Telescope Simulator", "EQUATORIAL_EOD_COORD")

# Wait until slew is done
telescopeState = "Busy"
while True:
    telescopeState = remote_object.getPropertyState("Telescope Simulator", "EQUATORIAL_EOD_COORD")
    if (telescopeState != "Ok"):
        time.sleep(1)
    else:
        break

print("Telescope slew is complete, tracking...")
print("Taking a 5 second CCD exposure...")

# Take 5 second exposure
remote_object.setNumber("CCD Simulator", "CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 5.0)
remote_object.sendProperty("CCD Simulator", "CCD_EXPOSURE")

# Wait until exposure is done
ccdState       = "Busy"
while True:
    ccdState = remote_object.getPropertyState("CCD Simulator", "CCD_EXPOSURE")
    if (ccdState != "Ok"):
        time.sleep(1)
    else:
        break

print("Exposure complete")

# Get image file name and open it in external fv tool
fileinfo = remote_object.getBLOBFile("CCD Simulator", "CCD1", "CCD1")
print("We received file: ", fileinfo[0], " with format ", fileinfo[1], " and size ", fileinfo[2])

print("Invoking fv tool to view the received FITS file...")
# run external fits viewer
command = "fv " + fileinfo[0]
os.system(command)

print("Shutting down INDI server...")
# Stop INDI server
remote_object.stop("7624")


Read More...

Thibault replied to the topic 'fully automated telescope control' in the forum. 4 months ago

Awesome ! Although I am a complete beginner to DBus scripting, I am going to make some experiments with this :)

Read More...

Login



3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!