User Tools

Site Tools


software

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software [2025/01/06 02:02] holtzsoftware [2025/05/10 18:09] (current) holtz
Line 4: Line 4:
  
 Overall software design is to control all components from a main server computer, song1m, located in Overall software design is to control all components from a main server computer, song1m, located in
-the main computer room, running Linux. This communicates with the telescope/camera computer, pwi1m, and the dome computer, dome1m, via network communication; this is extendable to additional device on additional computers. The preferred communication protocol is [[https://ascom-standards.org/|[ASCOM/Alpaca|]].+the main computer room, running Linux. This communicates with the telescope/camera computer, pwi1m, and the dome computer, dome1m, via network communication; this is extendable to additional devices on additional computers. It is largely a client-server model, where the server devices are interfaced over the network through [[https://ascom-standards.org/|ASCOM/Alpaca]].
  
 Devices can also be controlled locally from the computer to which they are attached, as this is useful for lower level functionality, debugging, etc. Devices can also be controlled locally from the computer to which they are attached, as this is useful for lower level functionality, debugging, etc.
Line 13: Line 13:
 ===== Control software ===== ===== Control software =====
  
-A full set of commands that communicate with all of the component devices is implemented in the aposong.py module in the APOsong repository ([[https://github.com/holtzmanjon/APOsong|github.com/holtzmanjon/APOsong]]). The communication is implemented (for the most part) with the [[https://ascom-standards.org/alpyca/|Alpyca]] Python interface to  Alpaca devices.+A full set of Python commands that communicate with all of the component devices is implemented in the aposong.py module in the APOsong repository ([[https://github.com/holtzmanjon/APOsong|github.com/holtzmanjon/APOsong]]). The communication is implemented (for the most part) with the [[https://ascom-standards.org/alpyca/|Alpyca]] Python interface to  Alpaca devices.
 Given that all of the devices are on the internal APO network, the main control computer, song1m, is located on this network, and remote operation can be done using VNC with an openVPN or tunneling connection. On song1m, the software environment is set up for the song user. Given that all of the devices are on the internal APO network, the main control computer, song1m, is located on this network, and remote operation can be done using VNC with an openVPN or tunneling connection. On song1m, the software environment is set up for the song user.
  
-The control software is run from a Python environment. APOsong provides convenienc routines to connect to Alpaca devices and provide user-friendly commands to control the telescope, dome, camera etc., but you can also use all regular Python functionality, providing for a powerful environment. Within the APOsong software, interactive image display is enabled using the pyvista display tool and built-in, e.g. for the expose() command, but of course any other Python packages can be used interactively. +An interactive client can be run from a Python environment. APOsong provides convenience routines to connect to Alpaca devices and provide user-friendly commands to control the telescope, dome, camera etc., but you can also use all regular Python functionality, providing for a powerful environment. Within the APOsong software, interactive image display is enabled using the pyvista display tool and built-in, e.g. for the expose() command, but of course any other Python packages can be used interactively. 
  
 To access the command set: To access the command set:
Line 30: Line 30:
 and you can use help(command) or command? to see the docstrings. and you can use help(command) or command? to see the docstrings.
  
-Documentation is also available at http://aposong.readthedocs.io+This will also provide instantiations of all of the Alpaca devices: Telescope as T, Dome as D, Safetymonitor as S, Cameras as C[], Switches as SW[], Focussers as F[].  
 + 
 +Documentation is available at http://aposong.readthedocs.io
  
 ===== Robotic software ===== ===== Robotic software =====
  
-Alternatively, robotic operation is implemented in the robotic.py module in this APOsong repository. This makes use of the command set provided by aposong.py, but adds in functionality for opening and closing the dome at appropriate times and under appropriate conditions, and selecting targets and exposure sequences from entries in the Postgres database. +Alternatively, robotic client is implemented in the robotic.py module in this APOsong repository. This makes use of the command set provided by aposong.py, but adds in functionality for opening and closing the dome at appropriate times and under appropriate conditions, and selecting targets and exposure sequences from entries in the Postgres database. 
  
 +For SONG operation, robotic operations will be conducted through Postgres database syncs from Aarhus, details TBD when this is implemented ...
 +
 +===== song1m computer =====
 +
 +This is the main computer interface. It is a virtual machine running on a box in the APO server room. Use the song account to log in. Once all remote software is started (see pwi1m, spec1m, and dome1m):
 +<code>
 +cd APOsong
 +ipython
 +> from aposong import *
 +</code>
 +
 +This should show you a list of commands (which you can see again with the commands() function), and a list of connected devices.
  
 ===== pwi1m computer ===== ===== pwi1m computer =====
Line 45: Line 59:
     * several ASCOM drivers for telescope, port 1 focuser, and mirror cover control     * several ASCOM drivers for telescope, port 1 focuser, and mirror cover control
     * a custom PlaneWave API interface     * a custom PlaneWave API interface
-  * ASCOM remote to make the telescope, focuser, mirror covers and camera / filter wheel accessible. This is used to set up the ASCOM cameras connected to PWI1port 1 imaging camera, port 2 acquisition/guide camera, and eShel spectrograph detector+  * ASCOM remote for communication with native Windows ASCOM drivers: 
 +    * PWI-4 interface 
 +    * PlaneWave Focuser (via PWI4) 
 +    * PlaneWave Mirror Cover (via PWI4) 
 +    * Atik guide camera 
 +    * Atik eShel camera 
 +    * QSI camera (for PlanWave port 1) 
 +    * QSI FilterWheel 
   * A custom Alpaca server which supports Alpaca drivers for:   * A custom Alpaca server which supports Alpaca drivers for:
-   *the Zaber focusing stage (Zaber XX) through an ASCOM Focuser device,  +   * the Zaber focusing stage (Zaber XX) through an ASCOM Focuser device,  
-   *the iodine stage (Thorlabs TLS 150 stage), commanded through an ASCOM Focuser device, +   * the calibration stage (Thorlabs LTS 150 stage), commanded through an ASCOM Focuser device 
 +   * the iodine stage (Thorlabs TLS 150 stage), commanded through an ASCOM Focuser device, 
    * the iodine cell temperature controller (Thorlabs TC300 controller), commanded through an ASCOM Switch device    * the iodine cell temperature controller (Thorlabs TC300 controller), commanded through an ASCOM Switch device
     the Shelyak eShel calibration unit, through an ASCOM Switch device.     the Shelyak eShel calibration unit, through an ASCOM Switch device.
 +
 +PlaneWave interface 4 is started from a desktop icon. It will open (after a minute or two) a graphical window (more details below). Need to ensure that telescope is connected and all motors/focuser are enabled.
 +
 +ASCOM remote is stated from a desktop icon. It may need to be restarted if power is cycled to any of the devices that it interfaces to. It takes a minute or two to start and should show connections to all of the devices listed above.
 +
 +The Alypca server is started from an Anaconda Python shell (start using Windows input). Once the terminal window comes up:
 +<code>
 +cd APOalpyca/device
 +python fpu_app.py
 +</code>
 +
 +The system should then be ready for remote usage.
 +
  
 === Planewave software === === Planewave software ===
 +
 +The PlaneWave software is not normally used for regular operation, as we just use the ASCOM and direct PWI interface. However, more detailed information and more command functionality is available through the PWI graphical interface, e.g., for pointing models and telescope troubleshooting. Hence we provide some information here.
  
 On pwi1m, the telescope is controlled through the PWI4 software. This also has the capability to control an ASCOM camera, necessary when using PWI4 to construct a pointing model. On pwi1m, the telescope is controlled through the PWI4 software. This also has the capability to control an ASCOM camera, necessary when using PWI4 to construct a pointing model.
Line 88: Line 125:
 === Alpaca devices === === Alpaca devices ===
  
-Several devices are controlled via ASCOM Alpaca, as implemented in the [Alpyca](https://ascom-standards.org/alpyca/package, using custom Alpaca drivers developed using the [[https://github.com/ASCOMInitiative/AlpycaDevice|AlpycaDevice]] templates:+Several devices are controlled via ASCOM Alpaca, as implemented in the [[https://ascom-standards.org/alpyca/|Alpyca]] package, using custom Alpaca drivers developed using the [[https://github.com/ASCOMInitiative/AlpycaDevice|AlpycaDevice]] templates:
  
  * ASCOM [[https://ascom-standards.org/alpyca/alpaca.focuser.html|Focuser]] devices  * ASCOM [[https://ascom-standards.org/alpyca/alpaca.focuser.html|Focuser]] devices
Line 95: Line 132:
  * ASCOM [[https://ascom-standards.org/alpyca/alpaca.switch.html|Switch]] devices   * ASCOM [[https://ascom-standards.org/alpyca/alpaca.switch.html|Switch]] devices 
   - TC300 https://www.thorlabs.com/thorproduct.cfm?partnumber=TC300, https://www.thorlabs.com/drawings/a037cd0c76c0bd79-A3C155F8-CDFD-BAC7-1B554FE246DB47DD/TC300-Manual.pdf   - TC300 https://www.thorlabs.com/thorproduct.cfm?partnumber=TC300, https://www.thorlabs.com/drawings/a037cd0c76c0bd79-A3C155F8-CDFD-BAC7-1B554FE246DB47DD/TC300-Manual.pdf
-  - Shelyak eShel calibration unit, built using K8056 rouginte+  - Shelyak eShel calibration unit, built using K8056 routine
  
-===== Dome software =====+Documentation of the Alpaca drivers can be found at [[https://apoalpyca.readthedocs.io/en/latest/|http://APOalpyca.readthedocs.io]]. 
 + 
 +===== spec1m computer ===== 
 + 
 +spec1m is the SONG spectrograph computer. It controls the spectrograph QHY detector and the Esatto focuser. It also controls two thermocouples that monitor the body temperature of the QHY and a relay that resets a watchdog timer if the body temperature is under a limit; otherwise the watchdog is not reset and the QHY camera power will be cut after 2-3 minutes. 
 + 
 +Run ASCOM remote for QHY interface and Esatto focuser interface. 
 + 
 +Run Alpyca server for thermocouple interface from an Anaconda terminal shell: 
 +<code> 
 +cd APOalpyca/device 
 +python spectro_app.py 
 +</code> 
 + 
 +Since the QHY power is controlled by the thermocouple interface, the ASCOM remote interface won't connect until this is run: it will prompt you to connect the ASCOM device within 10 seconds. 
 + 
 +===== dome1m =====
  
 Dome control is implemented through software running on a Raspberry Pi, dome1m. Dome control is implemented through software running on a Raspberry Pi, dome1m.
  
 Low-level functions are implemented in the APOAshDome.py module. An ASCOM Alpaca interface was implemented using the templates from the [[https://github.com/ASCOMInitiative/AlpycaDevice|AlpycaDevice]] package. Low-level functions are implemented in the APOAshDome.py module. An ASCOM Alpaca interface was implemented using the templates from the [[https://github.com/ASCOMInitiative/AlpycaDevice|AlpycaDevice]] package.
-Software is archived at [[https://github.com/holtzmanjon/APOAshDome]]. +Software is archived at [[https://github.com/holtzmanjon/APOalpyca]]. 
  
 APOAshDome controls dome shutter and rotation through relays, reads dome position through an encoder, and also reads dome home switch. For the encoder, the pulses are read using the pigpiod daemon, so that must be installed and started every time the computer is rebooted:  APOAshDome controls dome shutter and rotation through relays, reads dome position through an encoder, and also reads dome home switch. For the encoder, the pulses are read using the pigpiod daemon, so that must be installed and started every time the computer is rebooted: 
Line 110: Line 163:
 This has been implemented in /etc/rc.local on dome1m. This has been implemented in /etc/rc.local on dome1m.
  
-The dome software can be run locally from a python interface: from APOAshdome/device, start python and import APOAshdome. A Dome object can be instantiated through which properties and methods can be accessed: +The dome software can be run locally from a python interface: from APOalpyca/device, start python and import APOAshdome. A Dome object can be instantiated through which properties and methods can be accessed: 
 <code> <code>
 import APOAshDome import APOAshDome
-D = APOAshDome.Dome()+D = APOAshDome.APOAshDome()
 ... ...
 </code> </code>
  
-For documentation of the methods, see [[https://apoashdome.readthedocs.io/en/latest/|http://APOAshDome.readthedocs.io]].+For documentation of the methods, see [[https://apoalpyca.readthedocs.io/en/latest/|http://APOalpyca.readthedocs.io]].
  
-To start the Alpaca device after a reboot: +dome1m also runs an ASCOM Alpaca SafetyMonitor, APOSafetyThis returns True/False for issafe() by querying 25m and 35m dome status: if either is open, then issafe() returns True. APOSafety also has some custom supported actions to query 25m and 35m dome status independently, and has an Action('override',t) method that sets a timer within which issafe() returns True, regardless of 25m and 35m status.
-<code> +
-cd APOAshdome/device  +
-python app.py +
-</code>+
  
-dome1m also runs an ASCOM Alpaca SafetyMonitor, APOSafety, on port 5555. This returns True/False for issafe() by querying 25m and 35m dome status: if either is open, then issafe() returns True. APOSafety also has some custom supported actions to query 25m and 35m dome status independently, and has an Action('override',t) method that sets a timer within which issafe() returns True, regardless of 25m and 35m status. +The Alpyca servers runs on port 5555 on dome1m. To start the Alpaca devices after a reboot:
- +
-To start the Alpaca device after a reboot:+
 <code> <code>
-cd APOSafety/device  +cd APOalpyca/device  
-python app.py+python dome_app.py
 </code> </code>
- 
- 
  
  
Line 184: Line 229:
        
  ===== Linux installation =====  ===== Linux installation =====
 +
 +<code>
 +dnf install tcsh emacs git gnome-tweaks tigervnc-server gcc g++ strongswan
 +</code>
 +
 +change selinux to Permissive and reboot
 +
 +<code>
 +useradd --uid 1013 -d /home/song song
 +passwd song
 +add song user into /etc/tigervnc/vncserver.users
 +systemctl enable --now vncserver@:2
 +firewall-cmd --permanent --add-service=vnc-server
 +firewall-cmd --reload
 +
 +</code>
 +
 +set up ipsec.secrets, ipsec.conf
 +<code>
 +systemctl enable --now strongswan
 +</code>
  
 anaconda anaconda
 +  install
 +  
 +add ssh-key
 +<code>
 +git clone APOsong.git
 +cd APOsong
 +pip install -e .
 +</code>
   alpyca, tkthread, importlib_resources, photutils, astroscrappy, astroplan, astroquery, influxdb_client   alpyca, tkthread, importlib_resources, photutils, astroscrappy, astroplan, astroquery, influxdb_client
      
 postgres 13 postgres 13
 +<code>
 +dnf install postgresql postgresql-server
 +</code>
 +
 +pgadmin4
 +<code>
 +dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
 +dnf install -y https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
 +dnf install pgadmin4
 +</code>
 +
 +
 +Need to set up correct password authetication in pg_hba.conf and postgresql.conf
  
 influxdb influxdb
Line 217: Line 304:
 systemctl start influxdb systemctl start influxdb
 </code> </code>
 +
  
 influxdb-client influxdb-client
Line 230: Line 318:
    influx config create --config-name aposong --org NMSU --host-url http://localhost:8086 --token ***    influx config create --config-name aposong --org NMSU --host-url http://localhost:8086 --token ***
 </code> </code>
 +
 +For fresh install from backup
 +<code>
 +rm -rf /var/lib/influxdb
 +systemctl restart influxdb
 +influxdb setup --token ADMIN_TOKEN
 +influx restore /path/to/backup/  --full
 +</code>
 +
 +
 grafana grafana
  
-dnf install tigervnc-server+<code> 
 +wget -q -O gpg.key https://rpm.grafana.com/gpg.key 
 +sudo rpm --import gpg.key 
 +wget -q -O gpg.key https://rpm.grafana.com/gpg.key 
 +rpm --import gpg.key 
 +vi /etc/yum.repos.d/grafana.repo 
 +dnf install grafana 
 +systemctl daemon-reload 
 +systemctl start grafana-server 
 +</code> 
 + 
 +Copy existing grafana.db  to /var/lib/grafana
  
  
software.1736128954.txt.gz · Last modified: 2025/01/06 02:02 by holtz