Welcome, Guest
Username: Password: Remember me
14 Nov 2018
Glad to announce of release of INDI Library v1.7.5 on 2018-11-14. A few drivers were added in this release as we continue to improve & stabilize existing drivers.
Read More...
  • Page:
  • 1

TOPIC: launch ekos scheduler in command D-bus error

launch ekos scheduler in command D-bus error 8 months 1 day ago #24219

Hi,
I am trying to auto launch scheduler with a script.py and D-bus that I just discovered here by reading you.
here is the error :
Traceback (most recent call last):
File "startEkos.py", line 97, in <module>
"/KStars/Ekos/Scheduler" # Object's path
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.kstars.Ekos.Scheduler was not provided by any .service files


here is the complete code:
#!/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.
start_ekos = bus.get_object("org.kde.kstars", # Connection name
                               "/kstars/MainWindow_1/actions/ekos" # Object's path
                              )



# Get Ekos interface
iface = dbus.Interface(start_ekos, 'org.qtproject.Qt.QAction')



# Start Ekos devices
iface.trigger()

print "Starting Ekos..."

#now start indi progile
# 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 = [ "indi_simulator_telescope", "indi_simulator_ccd" ]

# Start INDI devices
iface.stop("7624")
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("Telescope Simulator", "CONNECTION", "CONNECT", "On")
# Send the switch to INDI server so that it gets processed by the driver
iface.sendProperty("Telescope Simulator", "CONNECTION")
# Same thing for CCD Simulator
iface.setSwitch("CCD Simulator", "CONNECTION", "CONNECT", "On")
iface.sendProperty("CCD Simulator", "CONNECTION")

telescopeState = "Busy"
ccdState       = "Busy"

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

print "Connected to Telescope and CCD is established."
# Create an object that will proxy for a particular remote object.

start_scheduler = bus.get_object("org.kde.kstars.Ekos.Scheduler", # Connection name
                               "/KStars/Ekos/Scheduler" # Object's path
                              )



# StartEkos Scheduler interface
iface = dbus.Interface(start_scheduler, "org.kde.kstars.Ekos.Scheduler")



# Start Ekos devices
iface.loadScheduler(test.esl )
#iface.start()

print "Starting Scheduler..."
Wich is almost a copy-paste from your tutorial code with little bit change.
I am kind of new to coding, please be kind.
Can you point me out why it is saying that it is not a .service?
I first was thinking I was miss typing the "/KStars/Ekos/Scheduler" at line 97, but D-feet give me that exact name.
So, I am lost and asking here.
Thank you
Attachments:

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

launch ekos scheduler in command D-bus error 8 months 8 hours ago #24242

I just used the following to load a scheduler file and it works just fine:
#!/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()
 
remote_object = bus.get_object("org.kde.kstars", "/KStars/Ekos/Scheduler")
iface = dbus.Interface(remote_object, 'org.kde.kstars.Ekos.Scheduler')
iface.loadScheduler("/home/jasem/Pictures/SchedularTest/capella.esl")

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

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

launch ekos scheduler in command D-bus error 8 months 4 hours ago #24251

Hi. Thank you. I am not sure to fully understand what I am doing, but I found my error in my previous code.
I finaly manage to get something working. Here is the code I made:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# You must initialize the gobject/dbus support for threading
# before doing anything.
import argparse
import gobject
import os
import time
parser = argparse.ArgumentParser (description='auto start Ekos sequence')
parser.add_argument('-s','--scheduler',type=str, help='scheduler file name located in /home/pi/filename, enter full path')
parser.add_argument('-p','--profile', default="Simulators", help='enter equippement profile name')
args = parser.parse_args()

gobject.threads_init()

from dbus import glib
glib.init_threads()

# Create a session bus.
import dbus
bus = dbus.SessionBus()

INDI = bus.get_object("org.kde.kstars", # Connection name
                               "/KStars/INDI" # Object's path
                              )
# Get INDI interface
iface = dbus.Interface(INDI, 'org.kde.kstars.INDI')

# Stop INDI devices (because that was giving me bug after in ekos)
iface.stop("7624")
 
# Create an object that will proxy for a particular remote object.
start_ekos = bus.get_object("org.kde.kstars", # Connection name
                               "/kstars/MainWindow_1/actions/ekos" # Object's path
                              )



# Get Ekos interface
iface = dbus.Interface(start_ekos, 'org.qtproject.Qt.QAction')



# Start Ekos devices
iface.trigger()

print ("Starting Ekos...")

#now start ekos progile
# Create an object that will proxy for a particular remote object.
Ekos = bus.get_object("org.kde.kstars", # Connection name
                               "/KStars/Ekos" # Object's path
                              )


# Get ekos interface
iface = dbus.Interface(Ekos, 'org.kde.kstars.Ekos')

#myDevices = [ "indi_simulator_telescope", "indi_simulator_ccd" ]

# Start INDI devices

iface.stop()
iface.disconnectDevices()
iface.setProfile(args.profile)
iface.start()
iface.connectDevices()
print "Waiting for INDI devices..."


run_scheduler = bus.get_object("org.kde.kstars", # Connection name
                                  "/KStars/Ekos/Scheduler" # Object's path
                              )



# StartEkos Scheduler interface
iface = dbus.Interface(run_scheduler, "org.kde.kstars.Ekos.Scheduler")



# Start Ekos devices
iface.loadScheduler(args.scheduler)
iface.start()

print "Starting Scheduler..."

This code take 2 optional arguments, --scheduler path/to/schedulerFile.esl
And --profile profile_name_as_string

So running python startEkos.py -s observing/target/sequence.esl -p equippement_profile_name

Automatically launch ekos and connect equippement and load sequence and start the auto focus platesolving auto guiding capturing session.

I could then change target in command line loading another scheduler file in command line.
Or auto start the whole process by just pluggin in the raspberry pi at boot.

This have been tested with simulators, not with real equippement yet.

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

launch ekos scheduler in command D-bus error 7 months 4 weeks ago #24275

You're mixing INDI & Ekos commands here unnecessarily. You only need to use the INDI interface if you need low-level access to the drivers. So if you load a scheduler file, and then issue Start then It should start INDI server + drivers...by itself.

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

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
  • Page:
  • 1
Time to create page: 0.294 seconds

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!


Gallery

Replica

Why INDI

Replica