Hi,
Thank you very much for your suggestions. I must admit that none of them is easy enough for me to solve the problem myself. I don't know anything about swig, and I have little C++ experience. So, I had hoped to just use the PyIndi interface for porting my Python application code.
From what you wrote it seems to me that the most promising way is to use the getDriverInterface function, and somehow get the comparison with the 2byte constants done. I will investigate on that further.
All the best,
Rolf
Read More...
Hi Jasem,
Something like this is what I need. Given the complete lack of documentation, however, it's impossible for me to find out myself how to access this info. You are right that PyIndi documentation is even worse than the rest. This really makes using PyIndi an extremely frustrating experience! I again had to do random experiments for several hours without success.knro wrote: For device type, property DRIVER_INFO.DRIVER_INTERFACE contains ORed values of Driver Interfaces . You can then know from that the type of the device. Not sure if there is a built in functionality for this in PyINDI.
driver_info = monitored_device.getText("DRIVER_INFO")
while not driver_info:
driver_info = monitored_device.getText("DRIVER_INFO")
time.sleep(0.05)
print ("DRIVER_INFO has type: " + str(type(driver_info)))
for element in driver_info:
print(driver_info[0].text
Telescope Simulator
indi_simulator_telescope
1.0
5
monitored_device.getDriverInterface()
/**
* @brief The DRIVER_INTERFACE enum defines the class of devices the driver implements. A driver may implement one or more interfaces.
*/
enum DRIVER_INTERFACE
{
GENERAL_INTERFACE = 0, /**< Default interface for all INDI devices */
TELESCOPE_INTERFACE = (1 << 0), /**< Telescope interface, must subclass INDI::Telescope */
CCD_INTERFACE = (1 << 1), /**< CCD interface, must subclass INDI::CCD */
GUIDER_INTERFACE = (1 << 2), /**< Guider interface, must subclass INDI::GuiderInterface */
FOCUSER_INTERFACE = (1 << 3), /**< Focuser interface, must subclass INDI::FocuserInterface */
FILTER_INTERFACE = (1 << 4), /**< Filter interface, must subclass INDI::FilterInterface */
DOME_INTERFACE = (1 << 5), /**< Dome interface, must subclass INDI::Dome */
GPS_INTERFACE = (1 << 6), /**< GPS interface, must subclass INDI::GPS */
WEATHER_INTERFACE = (1 << 7), /**< Weather interface, must subclass INDI::Weather */
AO_INTERFACE = (1 << 8), /**< Adaptive Optics Interface */
DUSTCAP_INTERFACE = (1 << 9), /**< Dust Cap Interface */
LIGHTBOX_INTERFACE = (1 << 10), /**< Light Box Interface */
DETECTOR_INTERFACE = (1 << 11), /**< Detector interface, must subclass INDI::Detector */
ROTATOR_INTERFACE = (1 << 12), /**< Rotator interface, must subclass INDI::RotatorInterface */
AUX_INTERFACE = (1 << 15), /**< Auxiliary interface */
};
Hi Oleh,
Thank you for pointing me at those web ressources. In fact, I had already read all of them. The problem is that none of them provides a detailed and systematic documentation of the interface.
I now gave up on the simulator and connected my Celestron NexStar mount instead. By trial and error I got the "slew to" and pulse guide operations working. So, I think it will be possible to port my software. That's good!
For the configuration setup in my program, I would like to present the user a list of all telescope drivers connected to the INDI server. I can produce a list of all drivers by using this code for the IndiClient class definition:
class IndiClient(PyIndi.BaseClient):
def __init__(self, device_list, device_name_list):
super(IndiDeviceListClient, self).__init__()
self.device_list = device_list
self.device_name_list = device_name_list
def newDevice(self, d):
self.device_list.append(d)
self.device_name_list.append(d.getDeviceName())
Thank you very much for your quick reply. I tried to find some documentation of the EQUATORIAL_PE property in the web, but this was unsuccessful. I then tried to just replace EQUATORIAL_EOD_COORD with EQUATORIAL_PE in my example code. That was how I interpreted your short comment in your post:
# get coordinate object
equatorial_pe = None
while not equatorial_pe:
time.sleep(0.5)
equatorial_pe = device.getNumber("EQUATORIAL_PE")
# Slew to fixed position in the sky.
ra = 1.5
de = 25.4
print("Slew to RA= " + str(ra) + ", DE= " + str(de))
equatorial_pe[0].value = ra
equatorial_pe[1].value = de
indiclient.sendNewNumber(equatorial_pe)
# get pulse guide objects
telescope_guideNS = None
while not telescope_guideNS:
time.sleep(0.5)
telescope_guideNS = device.getNumber("TELESCOPE_TIMED_GUIDE_NS")
# # wait until the scope has finished moving
# while equatorial_pe.s == PyIndi.IPS_BUSY:
# time.sleep(0.2)
# Stationary state reached, store measured position.
ra_before = equatorial_pe[0].value
de_before = equatorial_pe[1].value
# Issue an INDI "move north" instruction and wait a short time.
print("Move north 10000 milliseconds.")
telescope_guideNS[0].value = 1000.
telescope_guideNS[1].value = 0
indiclient.sendNewNumber(telescope_guideNS)
time.sleep(4.)
# # wait until the scope has finished moving
# while equatorial_pe.s == PyIndi.IPS_BUSY:
# time.sleep(0.2)
# Stationary state reached, store measured position.
ra_after = equatorial_pe[0].value
de_after = equatorial_pe[1].value
print("The telescope has moved north by "+str(3600*(de_after-de_before)) + "arc seconds.")
I started work on porting my MoonPanoramaMaker software from ASCOM to INDI. Since it's written in Python, I use the PyIndi package. Basically, I need two functions: slewing to a RA/DEC position, and a pulse guide operation in N/S/E/W for small coordinate adjustments. I managed to get the first one right. But I'm trying in vane to get pulse guiding working. To illustrate what I'm doing, please have a look at the following example code:
# get coordinate object
telescope_radec = None
while not telescope_radec:
time.sleep(0.5)
telescope_radec = device.getNumber("EQUATORIAL_EOD_COORD")
# get pulse guide objects
telescope_guideNS = None
while not telescope_guideNS:
time.sleep(0.5)
telescope_guideNS = device.getNumber("TELESCOPE_TIMED_GUIDE_NS")
# wait until the scope has finished moving
while telescope_radec.s == PyIndi.IPS_BUSY:
time.sleep(0.2)
# Stationary state reached, store measured position.
ra_before = telescope_radec[0].value
de_before = telescope_radec[1].value
# Issue an INDI "move north" instruction and wait a short time.
print("Move north 10000 milliseconds.")
telescope_guideNS[0].value = 10000.
telescope_guideNS[1].value = 0
indiclient.sendNewNumber(telescope_guideNS)
time.sleep(1.)
# wait until the scope has finished moving
while telescope_radec.s == PyIndi.IPS_BUSY:
time.sleep(0.2)
# Stationary state reached, store measured position.
ra_after = telescope_radec[0].value
de_after = telescope_radec[1].value
print("The telescope has moved north by "+str(3600*(de_after-de_before)) + "arc seconds.")