×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

indi python dbus script help

  • Posts: 314
  • Thank you received: 34
Hello
I want to slew my mount to a specific point. For example RA to 4:00:00 or DEC to 77.5. In kstars I can set only both values at once, but I only want to set them independently. I thought I could do this via python-dbus script as decribed in the tutorial. But because I talk to my mount via
indiserver "EQMod Mount"@rp:7624 indi_gphoto_ccd
I dont know how to set it in "myDevices": I tried
myDevices = [ "EQMod Mount@rp:7624", "indi_gphoto_ccd" ]
myDevices = [ '"EQMod Mount"@rp:7624', "indi_gphoto_ccd" ]
myDevices = [ "'EQMod Mount'@rp:7624", "indi_gphoto_ccd" ]
but none of this talkes to the raspberryPi server. Is this possible at all?

complete script:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
# You must initialize the gobject/dbus support for threading
# before doing anything.
import gobject
import os
import time
 
gobject.threads_init()
 
from dbus import glib
glib.init_threads()
 
# Create a session bus.
import dbus
bus = dbus.SessionBus()
 
# Create an object that will proxy for a particular remote object.
remote_object = bus.get_object("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:\n")
print remote_object.Introspect()
 
 
# Get INDI interface
iface = dbus.Interface(remote_object, 'org.kde.kstars.INDI')
 
myDevices = [ '"EQMod Mount"@rp', "indi_gphoto_ccd" ]
 
# Start INDI devices
iface.start("7624", myDevices)
 
print "Waiting for INDI devices..."
 
# Create array for received devices
devices = []
 
while True:
    devices = iface.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
iface.setSwitch("EQMod Mount", "CONNECTION", "CONNECT", "On")
# Send the switch to INDI server so that it gets processed by the driver
iface.sendProperty("EQMod Mount", "CONNECTION")
# Same thing for CCD Simulator
iface.setSwitch("GPhoto CCD", "CONNECTION", "CONNECT", "On")
iface.sendProperty("GPhoto CCD", "CONNECTION")
 
telescopeState = "Busy"
ccdState       = "Busy"
 
# Wait until devices are connected
while True:
    telescopeState = iface.getPropertyState("EQMod Mount", "CONNECTION")
    ccdState       = iface.getPropertyState("GPhoto CCD", "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
iface.setNumber("EQMod Mount", "EQUATORIAL_EOD_COORD", "RA", 4.000)
iface.setNumber("EQMod Mount", "EQUATORIAL_EOD_COORD", "DEC", 77.500)
iface.sendProperty("EQMod Mount", "EQUATORIAL_EOD_COORD")
 
# Wait until slew is done
telescopeState = "Busy"
while True:
    telescopeState = iface.getPropertyState("EQMod Mount", "EQUATORIAL_EOD_COORD")
    if (telescopeState != "Ok"):
        time.sleep(1)
    else:
        break
 
print "Telescope slew is complete, tracking..."
 
 
print "Shutting down INDI server..."
# Stop INDI server
iface.stop("7624")
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 6 months ago #5007

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

Is KStars running on the Raspberry PI? Because this script connects to KStars DBUS interface. If you want to control just INDI, you need to use indi_getprop and indi_setprop commands.
8 years 6 months ago #5024

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

  • Posts: 314
  • Thank you received: 34
EDIT: no, I ran it on the kstars client
I think indi_getprop and indi_setprop is the right thing.
I was able to get the current RA with:
indi_getprop -1 "EQMod Mount.EQUATORIAL_EOD_COORD.RA"
2.0731891016011587681

But I do not really get behind indi_setprop syntax. I tried
indi_setprop -v -n "EQMod Mount.EQUATORIAL_EOD_COORD.RA=2.3"
Connected to localhost on port 7624
  EQMod Mount.EQUATORIAL_EOD_COORD.RA <- 2.3

and the server does:
2015-09-13T14:18:37: Client 6: new arrival from 127.0.0.1:47427 - welcome!
2015-09-13T14:18:37: Client 6: read EOF
2015-09-13T14:18:37: Client 6: shut down complete - bye!
but nothing moves.
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 8 years 6 months ago by pauledd.
8 years 6 months ago #5058

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

You can't set RA alone, you need to set both RA & DEC. For example
indi_setprop -v -n "EQMod Mount.EQUATORIAL_EOD_COORD.RA;DEC=2.3;60"
8 years 6 months ago #5059

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

  • Posts: 314
  • Thank you received: 34
works, thanx!
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 6 months ago #5060

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

  • Posts: 314
  • Thank you received: 34
How can I make DEC moving in the opposite direction? When my mount is in home position DEC is 90. When I set it to 60 its pointing direction moves to the east. How can I move it to the west?
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 6 months ago #5061

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

Time to create page: 0.575 seconds