ligo-ex ligo-ds
  Richardson Lab Experimental Log, Page 14 of 14  Not logged in ELOG logo
ID Date Author Type Category Subject
  5   Mon Jun 6 17:11:48 2022 JonUpdateCamerasFLIR Camera Setup

Today I tested the Spinnaker/PySpin software installations (detailed in ELOG #4) with the FLIR camera connected to chimay. It works!

Example codes

I was able to run several of the PySpin example codes. In particular, there is one which connects to the camera and streams live data to a pop-up Matplotlib window that looks very useful. It is called AcquireAndDisplay.py.

When running these, it is important to keep in mind that PySpin requires Python 3.8, which is not the default system version on chimay. So to run AcquireAndDisplay.py, for example, you must explicitly call the correct version of Python:

$ python3.8 AcquireAndDisplay.py

The standard python and python3 aliases are still linked to the system version (3.9), so calling these will result in a PySpin import error.

Git repository

I have set up a git repo for our FLIR camera control code. I have populated it with an Examples directory which contains the PySpin Reference Manual as well as all the example codes (see the README). There is a local copy of this repo on chimay at /home/controls/FLIR.

Other FLIR streaming software

In addition to the PySpin demos, there are several fully developed applications provided by FLIR. While we do not plan to use these long term, they may be very useful for debugging and cross-validation of our Python interface during development:

  • Browser interface: From any web browser on the local lab network, navigate to http://192.168.1.6 and log in (credentials here). This interface supports live data streaming as well as full control of the camera settings.

  • SpinView: A standalone application provided as part of the Spinnaker SDK. It supports streaming live camera data as well as saving images and videos. It can be launched from the terminal on chimay via the command: $ spinview

  • Research Studio: This is FLIR's proprietary software, for which we have a one-year license. It can be launched from the terminal on chimay via the command: $ FLIRResearchStudio

Permanent cabling

Since everything appears to be working, I ran a permanent Cat 6 cable from the lab switch to the camera's power+I/O adapter. The adapter is plugged into a UPS-protected power strip overhanging the optical table, as pictured below. To prevent the adapter from unplugging itself under its own weight, I attached a zip tie around the adapter to hold it securely in place.

Attachment 1: IMG_1480.png
IMG_1480.png
Attachment 2: IMG_1481.png
IMG_1481.png
  4   Fri Jun 3 13:03:33 2022 JonUpdateCamerasFLIR Camera Setup

Summary

I have installed the requisite software on chimay for interfacing the FLIR A70 camera in Python. There are two packages required from FLIR:

  • Spinnaker SDK, which provides the low-level camera drivers and a C/C++ API.
  • PySpin, a wrapper of the Spinnaker library which provides the Python API.

These installations did not work out-of-the-box for Debian 11 (only Ubuntu is officially supported). I had to make several modifications which are documented below for future reference.

This setup has not yet been tested with the camera connected to chimay.

Documentation and Demo Codes

The PySpin package comes with a number of Python demo codes and a complete API reference. These can be found on chimay at the following locations.

  • Example codes: /opt/spinnaker/python/Examples/Python3/
  • Python API reference manual: /opt/spinnaker/python/docs/PySpinDoc.pdf

Installing Spinnaker SDK

Below were the steps required to install Spinnaker on chimay (Debian 11).

  1. Download the Spinnaker binaries (AMD64 architecture) and copy the tarball to, e.g., /home/controls on chimay.

  2. Unpack the tarball contents and enter the new directory:
    $ tar -xf spinnaker-2.6.0.160-Ubuntu20.04-amd64-pkg.tar.gz
    $ cd spinnaker-2.6.0.160-amd64


  3. Next, install the dependencies (on chimay, these were all already installed):
    $ sudo apt-get install libavcodec58 libavformat58 \
    libswscale5 libswresample3 libavutil56 libusb-1.0-0 \
    libpcre2-16-0 libdouble-conversion3 libxcb-xinput0 \
    libxcb-xinerama0
     
  4. There is one additional dependency, qt5-default, which is obsolete in Debian and no longer available via the package manager (that is, its functionality was absorbed into other Qt packages). I was able to find a workaround based on these instructions.

    1. Install all the dependencies of qt5-default:
      $ sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
       
    2. Manually remove the qt5-default dependency from the Spinnaker package.

      Unpack the spinview-qt_2.6.0.160_amd64.deb package:
      $ mkdir tmp
      $ cd tmp
      $ ar -x ../spinview-qt_2.6.0.160_amd64.deb
      $ tar xf control.tar.xz

      Open the file control in a text editor and delete the qt5-default dependency from the Depends list.

      Then repackage the contents:
      $ tar cfJ control.tar.xz control
      $ ar rcs ../spinview-qt_2.6.0.160_amd64.deb debian-binary control.tar.xz data.tar.xz
      $ cd ..
      $ rm -rf tmp

      This overwrites the original package with a version no longer containing the qt5-default dependency.


  5. Now proceed with running the install script:
    $ sudo sh install_spinnaker.sh

This will install the Spinnaker library at /opt/spinnaker. Spinnaker also provides a standalone GUI application, SpinView, which can be executed from the terminal (from any directory) via the command spinview.

Installing PySpin

The main challenge with installing PySpin was that it is currently only supported for Python <=3.8. The system installation on Debian 11 is Python 3.9 and 3.8 is not available within the package manager. Following these instructions, I manually installed a second version of Python (3.8) on chimay, in a way that should not interfere with the system installation.

The Python 3.8 executable is in the system path and can be run only via the command python3.8. It is not symlinked to python or to python3. Those remain linked to the preexisting Python 3.9.

After installing Python 3.8, I proceeded with the installation as follows:

  1. Download the PySpin package (x86_64 architecture) and copy the tarball to, e.g., /home/controls on chimay.

  2. Unpack the tarball contents and into a new directory:
    $ mkdir python
    $ mv spinnaker_python-2.6.0.160-Ubuntu20.04-cp38-cp38-linux_x86_64.tar.gz python
    $ tar xf spinnaker_python-2.6.0.160-Ubuntu20.04-cp38-cp38-linux_x86_64.tar.gz

  3. Move the new directory into the Spinnaker installation directory:
    $ sudo mv python /opt/spinnaker
    $ cd /opt/spinnaker/python
     
  4. Install the dependencies:
    $ sudo python3.8 -m pip install --upgrade numpy matplotlib

  5. Finally, install PySpin itself:
    $ sudo python3.8 -m pip install spinnaker_python-2.6.0.160-cp38-cp38-linux_x86_64.whl

If this succeeded, you should now be able to enter import the package PySpin as

$ python3.8
>>> import PySpin

without error.

  3   Thu Jun 2 21:55:02 2022 JonUpdateCamerasFLIR Camera Setup

The new FLIR A70 infrared camera has arrived. Tyler and I unpacked it in the lab yesterday. In less than an hour, we succeeded in powering it on and connecting it to the lab network. We have assigned it the static IP address 192.168.1.6.

Online Configuration Portal

The FLIR camera can be configured, as well as stream live data, through a web browser interface. It can be accessed from any workstation on the lab network by navigating in the browser to http://192.168.1.6. The login credentials are stored here (log in with your LIGO.ORG credentials).

Next Steps

The next step is to install FLIR's Python API for controlling and reading out the camera on chimay. The API comes with demo codes which we can use to test the basic connectivity and which will serve as a reference for developing our own Python interface over the summer.

Attachment 1: IMG_1473.png
IMG_1473.png
Attachment 2: IMG_1474.png
IMG_1474.png
  2   Thu Jun 2 16:14:58 2022 JonHowToGeneralCustom conda environment on JupyterHub

Cross-linking instructions: How to run a Jupyter notebook in your custom Conda environment

  1   Sun Apr 10 15:39:49 2022 Rutuja GuravHowToComputer Scripts/ProgramsHowTo: Renew the Let's Encrypt SSL certificate using certbot

Port 80 is kept closed by default. This might be causing the certbot auto-renewal cronjob to fail. Therefore we must renew the certificate manually.


Step 1: Open port 80. (This is needed as the certificate renewal process runs some tests which requires client communication over port 80)


Step 2: Run the following command


sudo certbot certonly --force-renew -d richardsonlab.ucr.edu


Step 3: Confirm the certificate was renewed by running the following command


sudo certbot certificates

ELOG V3.1.3-7933898