LoginSignup
1
2

More than 1 year has passed since last update.

ROS MelodicでFLIRやPOINTGRAYのカメラを使う方法

Last updated at Posted at 2022-10-12

はじめに

FLIRなどの特殊なカメラを動かす。ドライバのインストールなどでつまずいたり下ので備忘録として残す。

環境

・ ubuntu18.04
・ ros melodic

カメラの用意

まず一般の誤家庭にあるFLIR (BFS=U3−13Y3C-C)を用意します.
image.png

Spinnaker SDKのインストール

より Spinnaker Linuxをダウンロードする。ダウンロードしたらファイルを解凍し、以下コマンドを実行。

terminal
cd spinnaker-2.7.0.128-amd64/
./install_spinnaker.sh 

実行すると色々聞かれるのでとりあえず全部YESにする。

途中

terminal
This script will assist users in configuring their udev rules to allow
access to USB devices. The script will create a udev rule which will
add FLIR USB devices to a group called flirimaging. The user may also
choose to restart the udev daemon. All of this can be done manually as well.

Adding new members to usergroup flirimaging...
Current members of flirimaging group: usr
To add a new member please enter username (or hit Enter to continue):
$ 

と聞かれるので、user名を記入

terminal
This script will assist users in configuring their udev rules to allow
access to USB devices. The script will create a udev rule which will
add FLIR USB devices to a group called flirimaging. The user may also
choose to restart the udev daemon. All of this can be done manually as well.

Adding new members to usergroup flirimaging...
Current members of flirimaging group: usr
To add a new member please enter username (or hit Enter to continue):
$  user_name(任意の名前)

これを入れえ損なうとカメラ動かないので注意!!!!

あとはrebootして、動作をチェック!

動作確認

Spinnaker SDKを実行して確認!

Screenshot from 2022-10-12 15-20-25.png

このときカメラのS/Nシリアルナンバーを確認(あとで使う)!!

ROSパッケージをインストール

まずパッケージをインストール

terminal
cd catkin_ws/src/
git clone https://github.com/neufieldrobotics/spinnaker_sdk_camera_driver.git
Cloning into 'spinnaker_sdk_camera_driver'...
cd ..
catkin b

インストールしたらパラメータを変更

~/catkin_ws/src/spinnaker_sdk_camera_driver/params/test_params.yaml
cam_ids:
- 17197559 (さっき調べたシリアルナンバーに変更)
cam_aliases:
- cam0
master_cam: 17197559 (さっき調べたシリアルナンバーに変更)
skip: 20
delay: 1.0

# Assign all the follwing via launch file to prevent confusion and conflict

#save_path: ~/projects/data
#save_type: .bmp #binary or .tiff or .bmp
#binning: 1 # going from 2 to 1 requires cameras to be unplugged and replugged
#color: false
#frames: 50
#soft_framerate: 20 # this frame rate reflects to the software frame rate set using ros::rate
#exp: 997
#to_ros: true  #When to_ros is not selected, but live is selected, pressing 'space' exports single image to ROS

#Camera info message details
distortion_model: plumb_bob
image_height: 1080
image_width: 1440
distortion_coeffs:
- [-0.021141875266089592, -0.3733872931278025, 2.385982550579459, 3.2824571732099725]


#specified as [fx  0 cx 0 fy cy 0  0  1]
intrinsic_coeffs:
- [1886.9232141485886, 0.0, 604.7214878709341, 0.0, 1886.6668765711668, 493.47726714719823, 0.0, 0.0, 1.0]

rectification_coeffs:
- [1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000]

projection_coeffs:
- [913.700317, 0.000000, 953.448302, 0.000000, 0.000000, 1063.296631, 777.871993, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]

flip_horizontal:
- false

flip_vertical:
- false

region_of_interest:
  width: 0
  height: 0
  x_offset: 0
  y_offset: 0

変更できたらroslaunchしてみよう!

terminal1
roslaunch spinnaker_sdk_camera_driver node_acquisition.launch 
terminal2
rviz

結果

Screenshot from 2022-10-12 16-04-55.png

まとめ

・ubuntu18.04でspinnakerSDKを実行
・rosのパッケージの実行

1
2
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
2