rosでのwebカメラストリーム

rosで遠隔操作ロボットを作りたくなり,やっぱカメラは必要だよね->ROS入ったUbuntuでしかカメラチェックできないのはめんどいなあ...

となったので,ブラウザで確認できるように組みました.

元ネタはこちらですが,情報が断片的だったので,まとめておきます.

まずはパッケージのインストールとビルドです.

cd ~/catkin_ws/src
sudo apt-get install ros-kinetic-uvc-camera
git clone https://github.com/RobotWebTools/web_video_server.git
git clone https://github.com/GT-RAIL/async_web_server_cpp.git
cd ../
catkin_make

次にカメラ画像のトピックを飛ばします.

rosrun uvc_camera uvc_camera_node

別のターミナルを開いて

rostopic list

をすると

/camera_info
/image_raw
/image_raw/compressed
/image_raw/compressed/parameter_descriptions
/image_raw/compressed/parameter_updates
/image_raw/compressedDepth
/image_raw/compressedDepth/parameter_descriptions
/image_raw/compressedDepth/parameter_updates
/image_raw/theora
/image_raw/theora/parameter_descriptions
/image_raw/theora/parameter_updates

などと出てきます.今回は/image_rawをブラウザに表示させます.
ここで,配信サーバーを立ち上げます.

rosrun web_video_server web_video_server

この状態で,
http://[ROSを動かしているPCのIPアドレス]:8080/stream?topic=/image_raw
を表示すればカメラの画像が表示されています.

なお,今回ROSはRaspberryPi3で稼働しています.

コメント

タイトルとURLをコピーしました