Newer
Older
Instrument Control Software for small class observatory.
Currently in use at OARPAF
pip3 install requests loguru astropy
pip3 install gnuplotlib pyvantagepro # maybe I'll drop these.
# For the API:
pip3 install flask flask-restx werkzeug
# Tested with flask==3.0.2 werkzeug-3.0.1 flask-restx==1.3.0
# Tested with flask==3.0.2 werkzeug-3.0.1 flask-socketio==5.3.6 flask-httpauth==4.8.0
```
## Add the nodes of your observatory:
For example, in `config/nodes.ini`:
[MY_ASCOM_REMOTE_SERVER]
protocol = http
ip = 192.168.1.111
hostname = ascom.myobservatory.net
port = 533
endpoint = /api/v1
[MY_SONOFF_ADDRESS]
protocol = https
user = admin
password = admin
ip = 192.168.1.222
hostname = sonoff.myobservatory.net
port = 1234
## Connect the devices in your observatory to the nodes:
For example, in `config/devices.ini`:
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[my_tel]
module = alpaca
class = Telescope
node = MY_ASCOM_REMOTE_SERVER
[my_dome]
module = alpaca
class = Dome
node = MY_ASCOM_REMOTE_SERVER
[my_light]
module = domotics
class = Switch
node = MY_SONOFF_ADDRESS
outlet = 3
[my_dome_temperature]
module = domotics
class = Sensor
node = MY_SONOFF_ADDRESS
outlet1 = 1
outlet2 = 2
```
## Low-level control of your devices using ipython:
```
import devices
devices.my_dome.azimuth # 123
devices.my_dome.azimuth = 234
```
## Give to every device a REST API endpoint, or more
For example, in `config/api.ini`:
```
[/dome/position]
resource = Position
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[/dome/light]
resource = State
device = my_light
[/alias/to/light]
resource = State
device = my_light
[/dome/temperature]
resource = State
device = my_dome_temperature
[/telescope/coordinates]
resource = Coordinates
device = my_tel
```
## REST API-level control of your devices using curl:
First, start the API server with `./app.py 1111 localhost --noweb`
```
curl http://localhost:1111/api/dome/position
# {
# "error" : [],
# "raw" : true,
# "response" : {
# "azimuth" : 123.00,
# "parked" : "Yes"
# },
# "timestamp" : "2024-03-26T16:48:13.766195"
# }
# other examples:
# Change azimuth
curl -X POST http://localhost:1111/api/dome/position -d '234' -H 'Content-Type:application/json'
# Retrieve all GET endpoints relative to the dome
curl http://localhost:1111/all/dome
## Web-based control of your observatory:
Doc in progress
# Dome board:
```
sudo apt-get install python-dev libusb-dev swig libwxgtk3.0-gtk3-dev
git clone https://github.com/rm-hull/k8055.git
cd k8055
sed -i.bak 's/CC = gcc/CC = g++/' Makefile
sed -i.bak 's/\t/ /g' pyk8055/pyk8055.py
sed -i.bak 's/IOError, "Could not open device"/IOError("Could not open device")/g' pyk8055/pyk8055.py
make all
sudo make install
make pylib k8055gui
sudo make pyinstall guiinstall
```
# Dome software + Alpaca driver:
```
git clone https://github.com/lfini/SW-OPC-2.git
```
To push directly on observatory pc (for people without access to INAF repo)
```
# on obseravatory pc
git config receive.denyCurrentBranch updateInstead
# on local machine
git remote add machine user@machine:software-di-controllo
git push machine main
```
## System dependencies:
```
sudo apt install gnuplot gnupot-x11
sudo /home/zap/MBB/mbb -w 9000 -i 22000 -l /home/zap/MBB/mbb.log 10.185.119.248
```
[![Latest Release](https://www.ict.inaf.it/gitlab/davide.ricci/software-di-controllo/-/badges/release.svg)](https://www.ict.inaf.it/gitlab/davide.ricci/software-di-controllo/-/releases)