1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

aravisを使ってみる (その2)

Last updated at Posted at 2021-11-06

前回産業カメラ用linuxドライバのaravisのインストール方法をまとめました。

今回はこのドライバ内のコマンドとエラーと対策カメラ通信データの解析ツールについてまとめたいと思います。

コマンドまとめ

1.viewer

1.1 標準実行

  • カメラの映像を見れる
  • 設定も
./aravis-0.8.19/build/viewer/arv-viewer-0.8

2.フェイクカメラ起動

2.1 標準実行

./aravis-0.8.19/build/src/arv-fake-gv-camera-0.8 

2.2 シリアル番号を指定する場合

  • 複数した時は,シリアル番号を変える必要がある.
  • 以下の場合シリアル番号が2となる
./aravis-0.8.19/build/src/arv-fake-gv-camera-0.8 -s 2

3.テスト用コマンド

3.1 標準実行

  • カメラのframeが取れているかのテストに使用
./aravis-0.8.19/build/src/arv-camera-test-0.8

3.2 デバイス情報の取得

  • カメラのIPアドレスの確認に使用できる
./aravis-0.8.19/build/src/arv-camera-test-0.8 -d all

3.3 パッケトサイズを指定してテスト

  • 以下のように実行するとデバイスが出力するパケットサイズが今回の例では,1500になります。
./aravis-0.8.19/build/src/arv-camera-test -i 1500

4.ツールコマンド

arv-tool-0.8について

まず,使い方は以下のようになります。

$ ./arv-tool-0.8 --help
Usage:
  arv-tool-0.8 [OPTION?]  command <parameters>

Small utility for basic control of a Genicam device.

Help Options:
  -h, --help                                        Show help options

Application Options:
  -n, --name=<pattern>                              
  -a, --address=<device_address>                    
  --register-cache={disable|enable|debug}           Register cache policy
  --range-check={disable|enable}                    Range check policy
  -t, --time                                        Show execution time
  -d, --debug={<category>[:<level>][,...]|help}     

Command may be one of the following possibilities:

  genicam:                          dump the content of the Genicam xml data
  features:                         list all features
  values:                           list all available feature values
  description [<feature>] ...:      show the full feature description
  control <feature>[=<value>] ...:  read/write device features

If no command is given, this utility will list all the available devices.
For the control command, direct access to device registers is provided using a R[address] syntax in place of a feature name.

Examples:

arv-tool-0.8 control Width=128 Height=128 Gain R[0x10000]=0x10
arv-tool-0.8 features
arv-tool-0.8 description Width Height
arv-tool-0.8 -n Basler-210ab4 genicam

4.1 単体実行

接続されているデバイスが表示される.

$ ./arv-tools-0.8
Hikvision-MV-CA050-10GM-00F07117385 (192.168.11.100)

4.2 設定可能パラメータ

feturesオプションを使用すると,カメラで設定できるパラメータ名一覧が表示されます。
出力結果表示がかなり多かったので一部結果を記載します。

$ ./arv-tools-0.8 features
Hikvision-MV-CA050-10GM-00F07117385 (192.168.11.100)
Category    : 'Root'
    Category    : 'DeviceControl'
        Enumeration : 'DeviceType'
            EnumEntry   : 'Peripheral'
            EnumEntry   : 'Transceiver'
            EnumEntry   : 'Receiver'
            EnumEntry   : 'Transmitter'
        Enumeration : 'DeviceScanType'
            EnumEntry   : 'Linescan'
            EnumEntry   : 'Areascan'
        StringReg   : 'DeviceVendorName'

...

4.3 パラメータの保存アドレスなどを知る.

genicamオプションを使用すると,設定パラメータがカメラ内で保存されているアドレスやそのバイト長等が見れるみたいです.表示内容が多いのでtxtに出力して必要な項目を検索かけて使うのが良さそう.

./arv-tool-0.8 genicam > Genicam_aaa.txt

4.4 カメラ出力画像のサイズを変更したい

$ ./arv-tool-0.8 control Width=2448 Height=2048
Hikvision-MV-CA050-10GM-00F07117385 (192.168.11.100)
Width = 2448 min:32 max:2448 inc:4
Height = 2048 min:32 max:2048 inc:4

エラーと対策まとめ

1.認識してるが,フレームが取れない

  • 問題:コマンドまとめ3.1を実行した時に以下のようにframeが取れなかった場合
    image.png

  • 原因:写真のようにカメラのpacketサイズが8000とかで,pcのMTU(インタフェースのパケットサイズの上限)上限が1500だとフレームの取得に失敗する

  • 対策:その時は以下の様に実行するとcameraのパケットサイズを変更できる.
    パケットサイズをインタフェースのmtu以下な値で,コマンドまとめ3.3を実行(※インタフェースのmtuはifconfigで調べることができる)
    Screenshot from 2021-11-06 18-54-09.png
    mtuサイズ変更:https://atmarkit.itmedia.co.jp/flinux/rensai/linuxtips/418chkmtu.html

  • この問題に関するissue

2.サブネットを合わせる

GigaEカメラの場合pcとカメラのサブネットアドレスも一致させましょう.

解析ツール

1.wireshark

  • インタフェースに流れているデータが見れる

1.1 install

sudo apt install wireshark

1.2 実行

sudo wireshark -i {インタフェース名}

# ex.FakeCameraを解析する場合
sudo wireshark -i lo

2.iftop

  • インタフェースの通信量が見れる

2.1 install

sudo apt install iftop

2.2 実行

sudo iftop -i {インタフェース名}

# ex.FakeCameraを解析する場合
sudo iftop -i lo

次回

次回は,aravis内に用意されているテストプログラムを実行してみます。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?