Raspberry Pi Ubuntu Spinnaker SDK Setup

Raspberry Pi Ubuntu Spinnaker SDK Setup
Raspberry Pi Ubuntu Spinnaker SDKのセットアップ

These steps describe using an Ubuntu desktop environment to install Ubuntu and the Spinnaker Python interface on a Raspberry Pi 3 B+. Commands to be run on the desktop are prefaced with (desktop)$, and commands to be run on the Raspberry Pi are prefaced with (pi)$

この手順では、Ubuntuデスクトップ環境を使用して、Raspberry Pi 3 B+にUbuntuとSpinnaker Pythonインターフェースをインストールする方法を説明します。デスクトップ上で実行するコマンドの前には(desktop)$を、Raspberry Pi上で実行するコマンドの前には(pi)$を付けます。

  1. Flash the latest Ubuntu image (at the time of writing: 18.04) to an SD card and perform first-time setup by following these instructions. You will need an HDMI cable, a monitor, and a keyboard. The Raspberry Pi must also be connected to your local network via Ethernet.
    最新のUbuntuイメージ(執筆時点では18.04)をSDカードに書き込み、以下の手順に従って初回セットアップを行う。HDMIケーブル、モニター、キーボードが必要です。また、Raspberry Piはイーサネット経由でローカルネットワークに接続されている必要があります。

  2. Perform basic software updates on the Pi:
    Piの基本的なソフトウェアアップデートを行う:
    (pi)$ sudo apt update && sudo apt upgrade
  3. Go to the FLIR File Download website for your camera. The software downloads will require a free FLIR account.
    お使いのカメラのフリアーファイルダウンロードサイトにアクセスします。ソフトウェアのダウンロードにはフリアーシステムズの無料アカウントが必要です。

  4. On the FLIR website, find the latest Linux Ubuntu ARM Operating System packages.
    フリアーシステムズのウェブサイトで、最新のLinux Ubuntu ARMオペレーティングシステムパッケージをご覧ください。

  5. Download the ARM64 packages for the Spinnaker SDK and Spinnaker Python Interface, and transfer them to the Raspberry Pi. Eg:
    Spinnaker SDK と Spinnaker Python Interface の ARM64 パッケージをダウンロードし、Raspberry Pi に転送します。例

    (pi)$ ip a # check pi's ip address
    (desktop)$ scp spinnaker-*-pkg.tar.gz spinnaker_python-*.tar \
     ubuntu@<pi's ip address>:~
  6. On the Raspberry Pi, untar the spinnaker sdk and enter the untarred directory
    Raspberry Pi上で、spinnaker sdkをuntarし、untarしたディレクトリに入ります。
  7. Read the README file fully, then run the install script. Eg:
    READMEファイルを十分に読んでから、インストールスクリプトを実行してください。例

    (pi)$ sudo sh install_spinnaker_arm.sh
  8. You will probably run into some dependency issues while installing the SDK. If that’s the case, missing packages can be installed manually with:
    SDKのインストール中に依存関係の問題に遭遇することもあるでしょう。その場合、不足しているパッケージを手動でインストールすることができます:

    (pi)$ sudo apt install <name-of-missing-package>
    
    
  9. Change back to your home directory, untar the python interface, then untar the python 3.6 interface.
    ホームディレクトリに戻り、pythonインターフェースをuntarし、python 3.6インターフェースをuntarする。

    (pi)$ tar -xf spinnaker_python-1.*.tar
    (pi)$ tar -xf spinnaker_python-1.*cp36*.tar.gz 
  10. Read the README.txt fully, then install numpy and the Spinnaker python interface. At the time of writing, there are no precompiled wheels for numpy on Ubuntu ARM, so pip will compile the package from souce. This will take several hours, but can be sped up a bit by increasing the Pi's swap size.
    README.txtを十分に読み、numpyとSpinnaker pythonインターフェースをインストールします。この記事を書いている時点では、Ubuntu ARMにはnumpy用のプリコンパイルホイールがないので、pipがソースからパッケージをコンパイルします。これには数時間かかりますが、Piのスワップサイズを大きくすることで少しスピードアップできます。

    (pi)$ sudo apt install dphys-swapfile # (optional)
    # follow the rest of the increasing swap size tutorial (optional)
    (pi)$ sudo apt install python3-pip
    (pi)$ python3 -m pip install numpy
    (pi)$ sudo python3 -m pip install spinnaker_python-1.*.whl
  11. Ensure the python module can be imported successfully:
    pythonモジュールが正常にインポートできることを確認する:

    (pi)$ python3 -c 'import PySpin' # should take a few seconds, then exit silently

    You will probably run into more dependency issues here. When you try to import PySpin with a missing dependency, you'll get an error along the lines of No Such File: <name-of-missing-package>.so. See step 8 for help resolving these issues.
    おそらくここで依存関係の問題にもっとぶつかるでしょう。依存関係が見つからないPySpinをインポートしようとすると、No Such File: <名前-of-missing-package>.soというエラーが表示されます。このような問題の解決についてはステップ8を参照してください。

  12. Increase the space allocated to USB devices on the Pi. This is needed so that the images taken by the camera can fit properly within RAM. Note: This change will not persist through reboot and must be repeated.
    PiのUSBデバイスに割り当てられる容量を増やす。これは、カメラで撮影された画像がRAM内に適切に収まるようにするために必要です。注意: この変更は再起動しても維持されないので、繰り返し行う必要があります。

    (pi)$ sudo sh -c 'echo 256 > /sys/module/usbcore/parameters/usbfs_memory_mb'
  13. Connect your USB 3.1 FLIR camera to the Raspberry Pi via USB.
    USB3.1フリアーシステムズのカメラをUSB経由でRaspberry Piに接続します。

  14. Change into the Examples directory for PySpin, and run the Acquisition.py example as root. If this succeeds, the camera will take 10 pictures and store them as JPEGs in the current directory.
    PySpinのExamplesディレクトリに移動し、rootでAcquisition.pyを実行します。これが成功すると、カメラは10枚の写真を撮影し、JPEGとしてカレントディレクトリに保存します。

    (pi)$ cd Examples/Python3
    (pi)$ sudo python3 Acquisition.py
    
    

 

 

2023,江端さんの技術メモ

Posted by ebata