スキップしてメイン コンテンツに移動

ROS noetic camera install

#Intel Realsense  install

https://github.com/IntelRealSense/realsense-ros


sip2@sip2-2021:~$ sudo apt-get install ros-noetic-realsense2-camera

reboot


sip2@sip2-2021:~$ roslaunch realsense2_camera rs_camera.launch

or

sip2@sip2-2021:~$ roslaunch realsense2_camera rs_camera.launch filters:=pointcloud




# USB camera

https://ma38su.hatenablog.com/entry/2021/06/23/121926

https://qiita.com/Yuya-Shimizu/items/10804c9ac44a3568d116

 

 

ERROR: cannot launch node of type [usb_cam/usb_cam_node]: usb_cam
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/sip2/catkin_narobot/src
ROS path [2]=/opt/ros/noetic/share

sip2@sip2-2021:~/catkin_narobot$ sudo apt install ros-noetic-libuvc-camera ros-noetic-camera-calibration ros-noetic-image-proc

sip2@sip2-2021:~/catkin_narobot$ sudo apt install ros-noetic-usb-cam

sip2@sip2-2021:~/catkin_narobot$ sudo apt install ros-noetic-image-view

 

sip2@sip2-2021:~/catkin_narobot$ v4l2-ctl --list-devices

Command 'v4l2-ctl' not found, but can be installed with:

sudo apt install v4l-utils

sip2@sip2-2021:~/catkin_narobot$ sudo apt install v4l-utils

sip2@sip2-2021:~/catkin_narobot$ v4l2-ctl --list-devices
HD Webcam: HD Webcam (usb-0000:00:14.0-13):
    /dev/video0
    /dev/video1
    /dev/video2
    /dev/video3

sip2@sip2-2021:~/catkin_narobot$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 352x288
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.033s (30.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 352x288
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.033s (30.000 fps)

sip2@sip2-2021:~/catkin_narobot$ lsusb
Bus 004 Device 003: ID 0bda:0316 Realtek Semiconductor Corp. USB3.0-CRW
Bus 004 Device 002: ID 0bda:0411 Realtek Semiconductor Corp. 4-Port USB 3.0 Hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 8087:0026 Intel Corp.
Bus 003 Device 005: ID 04f2:b71a Chicony Electronics Co., Ltd HD Webcam
Bus 003 Device 003: ID 048d:6004 Integrated Technology Express, Inc. ITE Device(8291)
Bus 003 Device 004: ID 046d:c542 Logitech, Inc. 4-Port USB 2.0 Hub
Bus 003 Device 002: ID 0bda:5411 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

sip2@sip2-2021:~/catkin_narobot$ ls /dev/video*
/dev/video0  /dev/video1  /dev/video2  /dev/video3


reference

https://qiita.com/Yuya-Shimizu/items/10804c9ac44a3568d116

<launch>
<!-- usb_acmノードを実行する -->
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen">
<!-- カメラの指定 defaultは/dev/video0 -->
<param name="video_device" value="/dev/video0"/>
<!-- 画像の大きさ(横幅)の指定 -->
<param name="image_width" value="640"/>
<!-- 画像の大きさ(縦幅)の指定 -->
<param name="image_height" value="480"/>
<!-- 画像フォーマット設定 "mjpeg" or "yuyv" or "uyvy" -->
<param name="pixel_format" value="mjpeg"/>
<!-- fpsの指定 frame per second -->
<param name="framerate" value="30"/>
<!-- コントラストの設定(色設1) -->
<param name="contrast" value="32"/>
<!-- 明るさの設定(色設2) -->
<param name="brightness" value="32"/>
<!-- 彩度の設定(色設3) -->
<param name="saturation" value="32"/>
<!-- 自動フォーカス機能の設定 ブール値 -->
<param name="autofocus" value="true"/>
<!-- フォーカス位置の設定 -->
<param name="focus" value="51"/>
</node>

<!-- image_viewノードを実行する -->
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<!-- image_viewのimageトピックがimage_rawトピックをサブスクライブするように指定 -->
<remap from="image" to="/usb_cam/image_raw"/>
<!-- 画像の縦横比を自動で判定して表示 ブール値 -->
<param name="autosize" value="true"/>
</node>
</launch>




#FLIR thermal camera install

sip2@sip2-2021:~$ mkdir -p ~/catkin_flir/src
sip2@sip2-2021:~$ cd catkin_flir/
sip2@sip2-2021:~/catkin_flir$ cd src/
sip2@sip2-2021:~/catkin_flir/src$ git clone https://github.com/astuff/flir_boson_usb.git
Cloning into 'flir_boson_usb'...
remote: Enumerating objects: 257, done.
remote: Counting objects: 100% (39/39), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 257 (delta 33), reused 31 (delta 31), pack-reused 218
Receiving objects: 100% (257/257), 44.95 KiB | 7.49 MiB/s, done.
Resolving deltas: 100% (121/121), done.
sip2@sip2-2021:~/catkin_flir/src$ cd ..
sip2@sip2-2021:~/catkin_flir$ catkin_make
Base path: /home/sip2/catkin_flir
Source space: /home/sip2/catkin_flir/src
Build space: /home/sip2/catkin_flir/build
Devel space: /home/sip2/catkin_flir/devel
Install space: /home/sip2/catkin_flir/install
Creating symlink "/home/sip2/catkin_flir/src/CMakeLists.txt" pointing to "/opt/ros/noetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/sip2/catkin_flir/src -DCATKIN_DEVEL_PREFIX=/home/sip2/catkin_flir/devel -DCMAKE_INSTALL_PREFIX=/home/sip2/catkin_flir/install -G Unix Makefiles" in "/home/sip2/catkin_flir/build"
####
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/sip2/catkin_flir/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /usr/lib/python3/dist-packages/em.py  
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/sip2/catkin_flir/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Found Threads: TRUE  
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - flir_boson_usb
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'flir_boson_usb'
-- ==> add_subdirectory(flir_boson_usb)
-- Found OpenCV: /usr (found version "4.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sip2/catkin_flir/build
####
#### Running command: "make -j16 -l16" in "/home/sip2/catkin_flir/build"
####
Scanning dependencies of target geometry_msgs_generate_messages_cpp
Scanning dependencies of target geometry_msgs_generate_messages_lisp
Scanning dependencies of target bond_generate_messages_lisp
Scanning dependencies of target roscpp_generate_messages_lisp
Scanning dependencies of target geometry_msgs_generate_messages_nodejs
Scanning dependencies of target geometry_msgs_generate_messages_py
Scanning dependencies of target sensor_msgs_generate_messages_py
Scanning dependencies of target nodelet_generate_messages_eus
Scanning dependencies of target rosgraph_msgs_generate_messages_py
Scanning dependencies of target rosgraph_msgs_generate_messages_cpp
Scanning dependencies of target rosgraph_msgs_generate_messages_lisp
Scanning dependencies of target roscpp_generate_messages_nodejs
Scanning dependencies of target rosgraph_msgs_generate_messages_eus
Scanning dependencies of target std_msgs_generate_messages_cpp
Scanning dependencies of target std_msgs_generate_messages_eus
Scanning dependencies of target roscpp_generate_messages_py
[  0%] Built target bond_generate_messages_lisp
[  0%] Built target geometry_msgs_generate_messages_lisp
[  0%] Built target geometry_msgs_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_cpp
[  0%] Built target geometry_msgs_generate_messages_py
[  0%] Built target geometry_msgs_generate_messages_nodejs
[  0%] Built target roscpp_generate_messages_lisp
[  0%] Built target rosgraph_msgs_generate_messages_py
[  0%] Built target sensor_msgs_generate_messages_py
[  0%] Built target rosgraph_msgs_generate_messages_eus
[  0%] Built target roscpp_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target nodelet_generate_messages_eus
[  0%] Built target roscpp_generate_messages_py
Scanning dependencies of target std_msgs_generate_messages_lisp
Scanning dependencies of target rosgraph_msgs_generate_messages_nodejs
Scanning dependencies of target std_msgs_generate_messages_nodejs
Scanning dependencies of target bond_generate_messages_py
Scanning dependencies of target geometry_msgs_generate_messages_eus
Scanning dependencies of target nodelet_generate_messages_lisp
Scanning dependencies of target roscpp_generate_messages_cpp
Scanning dependencies of target nodelet_generate_messages_cpp
Scanning dependencies of target sensor_msgs_generate_messages_eus
Scanning dependencies of target roscpp_generate_messages_eus
Scanning dependencies of target std_msgs_generate_messages_py
Scanning dependencies of target sensor_msgs_generate_messages_cpp
Scanning dependencies of target bond_generate_messages_nodejs
Scanning dependencies of target nodelet_generate_messages_py
Scanning dependencies of target nodelet_generate_messages_nodejs
[  0%] Built target nodelet_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_nodejs
[  0%] Built target geometry_msgs_generate_messages_eus
[  0%] Built target roscpp_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target bond_generate_messages_py
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target nodelet_generate_messages_lisp
Scanning dependencies of target bond_generate_messages_eus
[  0%] Built target roscpp_generate_messages_eus
[  0%] Built target sensor_msgs_generate_messages_eus
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target bond_generate_messages_nodejs
[  0%] Built target sensor_msgs_generate_messages_cpp
[  0%] Built target nodelet_generate_messages_nodejs
[  0%] Built target bond_generate_messages_eus
Scanning dependencies of target sensor_msgs_generate_messages_nodejs
Scanning dependencies of target bond_generate_messages_cpp
[  0%] Built target nodelet_generate_messages_py
Scanning dependencies of target sensor_msgs_generate_messages_lisp
[  0%] Built target bond_generate_messages_cpp
[  0%] Built target sensor_msgs_generate_messages_nodejs
[  0%] Built target sensor_msgs_generate_messages_lisp
Scanning dependencies of target BosonCamera
Scanning dependencies of target flir_boson_usb_node
[ 25%] Building CXX object flir_boson_usb/CMakeFiles/flir_boson_usb_node.dir/src/flir_boson_usb_node.cpp.o
[ 50%] Building CXX object flir_boson_usb/CMakeFiles/BosonCamera.dir/src/nodelets/BosonCamera.cpp.o
[ 75%] Linking CXX executable /home/sip2/catkin_flir/devel/lib/flir_boson_usb/flir_boson_usb_node
[ 75%] Built target flir_boson_usb_node
[100%] Linking CXX shared library /home/sip2/catkin_flir/devel/lib/libBosonCamera.so
[100%] Built target BosonCamera


sip2@sip2-2021:~/catkin_flir$ v4l2-ctl --list-devices
HD Webcam: HD Webcam (usb-0000:00:14.0-13):
    /dev/video0
    /dev/video1
    /dev/video2
    /dev/video3

Boson: FLIR Video (usb-0000:00:14.0-4):
    /dev/video4
    /dev/video5


flir_boson_usb/launch/flir_boson_usb.launch

<?xml version="1.0"?>
<launch>
<arg name="namespace" default="flir_boson"/>
<arg name="frame_id" default="boson_camera"/>

<!-- the linux file descriptor location for the camera -->
<arg name="dev" default="/dev/video4"/>

<!-- valid values are 30.0 or 60.0 for Bosons -->
<arg name="frame_rate" default="30.0"/>

<!-- valid values are RAW16 or YUV -->
<arg name="video_mode" default="YUV"/>

<!-- valid values are TRUE or FALSE -->
<arg name="zoom_enable" default="FALSE"/>

<!-- valid values are Boson_320 or Boson_640 -->
<arg name="sensor_type" default="Boson_640"/>

<!-- location of the camera calibration file -->
<arg name="camera_info_url" default="package://flir_boson_usb/example_calibrations/Boson640.yaml"/>

<node pkg="flir_boson_usb" type="flir_boson_usb_node" name="flir_boson_usb_node" ns="$(arg namespace)">
<param name="frame_id" type="str" value="$(arg frame_id)"/>
<param name="dev" type="str" value="$(arg dev)"/>
<param name="frame_rate" type="double" value="$(arg frame_rate)"/>
<param name="video_mode" type="str" value="$(arg video_mode)"/>
<param name="zoom_enable" type="bool" value="$(arg zoom_enable)"/>
<param name="sensor_type" type="str" value="$(arg sensor_type)"/>
<param name="camera_info_url" type="str" value="$(arg camera_info_url)"/>
</node>
</launch>


sip2@sip2-2021:~/catkin_flir$ source devel/setup.bash
sip2@sip2-2021:~/catkin_flir$ roslaunch flir_boson_usb flir_boson.launch




コメント

このブログの人気の投稿

[참고] ROS kinetic에서 WebCam 사용하기 (Ubuntu 16.04)

Reference: 1. https://github.com/bosch-ros-pkg/usb_cam/issues/53  2. http://zumashi.blogspot.jp/2016/12/ros-kinetic-usb-cam.html  3. http://cafe.naver.com/openrt/5963 위의 사이트들을 참고하여 ROS Kinetic에서 Logitech WebCam C270의 동작을 확인했습니다. $ cd ~/catkin_ws/src $ git clone https://github.com/bosch-ros-pkg/usb-cam.git $ cd .. $ catkin_make WebCam test $ roscore $ rosrun usb_cam usb_cam_node $ rosrun image_view image_view image:=/usb_cam/image_raw $ rosrun rviz rviz 1) By display type>rviz>image 2) Image topic: /usb_cam/image_raw --> 왼쪽 하단과 같이 WebCam이 잘 동작하는 것을 확인했습니다.

[vscode] TImeout waiting for debugger connection

이제까지 잘 동작하던 비주얼 스튜디오 코드가 위와 같은 에러 메세지를 내면서 갑자기 디버깅이 안되서 인터넷을 검색한 결과.. vscode의 User Setting에서 검색창에 python.terminal.activateEnvironment을 입력하여 true로 설정되어 있는 값을 false로 변환하면 된다. 

Anaconda을 이용하여 ROS + Tensorflow 함께 사용하기

-- CUDA, cuDNN 버전확인 https://stackoverflow.com/questions/41714757/how-to-find-cuda-version-in-ubuntu/42122965 $ nvcc --version cuda8.0, cudnn6.0 -- 아나콘다 python2.7 버전 인스톨 https://www.anaconda.com/download/#linux python3.x이랑 ROS 같이 써보려고 했는데, 아직 실력이 부족해서 그런지 실패.. $ bash Anaconda2-5.3.0-Linux-x86_64.sh $ source ~/.bashrc $ python -V Python 2.7.15 :: Anaconda, Inc. $ conda create -n tf14 pip python=2.7 $ source activate tf14 -- ROS 관련 패키지 인스톨 (tf14) $ pip install --upgrade pip (tf14) $ pip install -U rosinstall msgpack empy defusedxml netifaces --CUDA, cuDNN, CPU/GPU을 사양에 맞춰서 tensorflow download https://github.com/mind/wheels#mkl (tf14) $ pip install tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl 잘 설치가 되었는지 Hello, tensorflow 실행 (tf14) $ python Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> i