Enable drivers to be written for instrument control using the INDI protocol.
Project description
indipydriver
Enable drivers to be written for instrument control using the INDI protocol.
INDI - Instrument Neutral Distributed Interface.
See https://en.wikipedia.org/wiki/Instrument_Neutral_Distributed_Interface
The protocol defines the format of the data sent, such as light, number, text, switch or BLOB (Binary Large Object) and the client can send commands to control the instrument. The client takes the display format of switches, numbers etc., from the protocol.
INDI is often used with astronomical instruments, but is a general purpose protocol which can be used for any instrument control.
Indipydriver provides classes of 'members', 'vectors' and 'devices', where members hold instrument values, such as switch and number values. Vectors group members together, with labels and group strings, which inform the client how to display the values. 'Devices' hold a number of vectors, so a single device can display several groups of controls.
The 'IPyDriver' class holds one or more devices, and provides methods you can use to send and receive data, which you would use to interface with your own code.
This is one of associated packages.
Indipydriver provides classes to work with your own code to control instruments and produce the INDI protocol.
Indipyserver provides an 'IPyServer' class to run drivers and serve the INDI protocol on a port.
Indipyweb is an INDI client and a web server, it connects to the serving INDI port and provides a web view of instruments.
Indipyterm is a terminal client, which connects to the serving port and can be run to view the instrument controls.
Indipyterm can be remote, or could work on the same machine. As it is a terminal client, it could be run from an SSH connection, conveniently allowing headless operation.
These packages are available on Pypi, and should interwork with other services that follow the INDI specification.
The image below shows the indipyterm terminal connected to a server running an example driver (switching on or off an LED on a RaspberryyPi). The example is described at:
https://indipydriver.readthedocs.io/en/latest/usage/firstexample.html#firstexample
To write a driver, you would create a subclass of IPyDriver and override the following methods.
async def rxevent(self, event)
This is automatically called whenever data is received from the client to set an instrument parameter. The event object describes the received data, and you provide the code which then controls your instrument.
async def hardware(self)
This is called when the driver starts, and as default does nothing, typically it could be a contuously running coroutine which you can use to operate your instruments, and if required send updates to the client.
async def snoopevent(self, event)
This is only used if the device is monitoring (snooping) on other devices.
Having created a driver, you could await its asyncrun() method, which will then communicate by stdin and stdout.
import asyncio
import ... your own modules creating 'mydriver'
asyncio.run(mydriver.asyncrun())
If you made such a script executable, then this driver could be run with third party INDI servers, which expect a driver to be an executable program using stdin and stdout.
Alternatively you could serve your driver, or drivers, by importing IPyServer from indipyserver:
import asyncio
from indipyserver import IPyServer
import ... your own modules creating driver1, driver2 ...
server = IPyServer(driver1, driver2, host="localhost", port=7624, maxconnections=5)
asyncio.run(server.asyncrun())
A connected client can then control all the drivers. The above illustrates multiple drivers can be served.
Documentation at https://indipydriver.readthedocs.io
Installation from https://pypi.org/project/indipydriver
indipyserver available from https://pypi.org/project/indipyserver
indipyweb available from https://pypi.org/project/indipyweb
indipyterm available from https://pypi.org/project/indipyterm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indipydriver-3.0.4.tar.gz.
File metadata
- Download URL: indipydriver-3.0.4.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae0b4c8b423fe1bd1800236ab73fbe1333c1aaec46761e5976bf1e28179f677
|
|
| MD5 |
a88383c5e7ab9cba3778f886c68139e0
|
|
| BLAKE2b-256 |
fb53a3b5b2bc575e7ecf7e7cb7da8a3c9d368629622ff1dff6e3c6c08c747237
|
File details
Details for the file indipydriver-3.0.4-py3-none-any.whl.
File metadata
- Download URL: indipydriver-3.0.4-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90fba69a9f5036bb999e263dd3a114910a3fd167b55ff4f61e1baca366278078
|
|
| MD5 |
fb065bbf0dd0489138a84f059999995f
|
|
| BLAKE2b-256 |
62117727079b0d56c382ec258a4148d016d11e4a726d3d4a71f5e4b1498cbb4b
|