OSL has recently updated the control software for the Hydra instrument on the WIYN Observatory’s 3.5m telescope. Hydra is a spectroscopic-fibre positioner that places up to 100 fibres across a 38cm focal plane to a design precision of 10 microns. The control software commands the robotic positioner to deploy these fibres on scientific targets whilst ensuring that the fibres do not physically impact each other. WIYN had recently replaced the robotic motors and the motor controller, and the new control software provided by OSL helps to take better advantage of these upgrades. The project included a new server-client architecture, improvements to the motor controller PLC logic, and a streamlined new client interface, making the instrument nearly three times faster, less liable to mechanical failures, and more user friendly.
Hydra is a robotic spectroscopic-fibre positioner mounted on the Nasmyth port of the 3.5m WIYN optical telescope. It contains three distinct fibre bundles, including sets of approximately 90 red and blue optimised fibres as well as a set of 12 seven-fibre arrays used for guiding. The Hydra instrument positions the red or blue fibres over a one-degree (38cm) field-of-view focal plane, ensuring that the fibres do not physically collide and that they are placed with a design tolerance of 0.1 arcsec (equivalent to 10 micron positioning accuracy).
Hydra recently has undergone several hardware upgrades, including installing new servo motors for the robotic fibre position as well as replacing the old microcontroller board with a PLC for driving those motors. Consequently, OSL was commissioned to develop new control software to take full advantage of these upgrades. This includes robust safety checks to ensure that fibres are not moved in ways that might damage them, as well as enhanced user interfaces to optimise the operation of the instrument and support troubleshooting of anomalous hardware motions and states.
The first step toward updating the Hydra software was for OSL and WIYN staff – including engineers, scientists, and operators – to work together to capture design requirements and formulate a new framework for the system. A client-server paradigm was developed to separate hardware control and user interactions, and a communications scheme was created to allow multiple users (on-site and remote scientists, telescope operators, etc) to manage the instrument simultaneously. The interface between the new server and PLC was revamped to more directly expose the state of the PLC and instrument. Furthermore, handshaking between the hardware and software was added to ensure that both were well synchronized and therefore reflecting the same state.
Next, OSL produced a Python-based simulator of the PLC to aid in the server development by minimizing the need to access the hardware directly. This helped to further refine details of the hardware-software interface and to identify improvements to the PLC logic to more optimally use the hardware. The simulator will also be used by scientists as they create and test observing strategies for the instrument.
The server itself was written in C++ to create a fast and highly maintainable system that can readily interface with other WIYN systems through their existing C-based communication scheme (the WIYN Generic Client, or GWC). Mature external libraries for communications (0MQ, libmodbus) and geometry (libGEOS) were used in place of large amounts of old code that were no longer maintained or understood. Additionally, the Google logging library glog was used to much more fully capture communication and state details. The server implements a multi-threaded control paradigm to manage its connections with clients, the instrument’s PLC, and other WIYN systems.
The Hydra client was implemented in Python using the PyQt6 toolkit. The several disparate windows used by the old software were simplified into a single interface that cleanly displays the system state and accepts command input. The client exploits the updated software-hardware interface to graphically depict hardware motions in real time. Furthermore, it provides intuitive pushbutton-based command input rather than relying on commandline incantations (although a commandline interface is still supported). Warnings, errors, and faults are clearly displayed, and the system log is viewable from all connected clients.
OSL and WIYN worked together to deploy and test the new software, from daytime commissioning on the hardware to nighttime on-sky operations. This process also included integrating new tools into the software to help to better characterise the instrument. Routines were developed to: automatically record the positions of each deployed fibre; determine the precise locations of fibres within their housings; and measure star positions in the instrument’s coordinate system for accurate astrometric registration. Additionally, OSL supported initial science operations, which helped to further improve the software interface.
One of the least visible but most important updates to Hydra was the improvement to the hardware-software interface. OSL provided WIYN with PLC logic updates throughout the project, leading to dramatic improvements in performance, significantly better error handling, and more robust operations. The closer integration of hardware and software improved fibre setup times from approximately 20 minutes to approximately 6 minutes, and the hardware-software handshaking has resolved long-standing issues of incorrect hardware movements.
Observatory Sciences has provided WIYN with a modern distributed control system which has improved the performance, robustness, maintainability and user experience of the spectroscopic-fibre positioner. If you would like to find out more about how Observatory Sciences could help upgrade your control systems, please get in touch!

