usb_cam
ROS2

usb_cam

테스트 환경

  • ROS Foxy
  • Webcam

QuickStart

ros 환경 설정 후 usb-cam 패키지를 설치합니다.

source /opt/ros/foxy/setup.bash
sudo apt install ros-foxy-usb-cam

 

usb_cam을 실행

source /opt/ros/foxy/setup.bash
ros2 run usb_cam_usb_cam_node_exe

 

Buliding from Source

저장소를 구성한 뒤 패키지를 다운 받습니다.

mkdir -p ~/colcon_ws/src
cd ~/colcon_ws/src
git clone -b ros2 https://github.com/ros-drivers/usb_cam.git

 

빌드 진행

cd ~/colcon_ws

sudo rosdep init # if you have not done this before
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
*rosdep: command not found 시 
sudo apt install python3-rosdep 진행
*Cannot locate rosdep definition for [camera_info_manager]* 시 
sudo apt install ros-foxy-camera-info-manager

colcon build --cmake-args -DCMAKE_CXX_STANDARD=17
*colcon: command not found 시
sudo apt install python3-colcon-common-extensions

 

usb_cam 패키지를 실행시키기 위한 환경 설정

source ~/colcon_ws/install/setup.bash

 

usb_cam 패키지를 실행하기 전 터미널을 열어 roscore 실행

source /opt/ros/noetic/setup/bash
roscore

 

usb_cam 패키지를 실행하기 위해 아래 명령 중 하나 실행

# run the executable with default settings (without params file)
ros2 run usb_cam usb_cam_node_exe

# run the executable while passing in parameters via a yaml file
ros2 run usb_cam usb_cam_node_exe --ros-args --params-file /path/to/colcon_ws/src/usb_cam/config/params.yaml

# launch the usb_cam executable that loads parameters from the same `usb_cam/config/params.yaml` file as above
# along with an additional image viewer node
ros2 launch usb_cam camera.launch.py

 

usb_cam을 통해 전송되는 이미지를 보기위해서는 rqt_image_view를 실행

source /opt/ros/noetic/setup/bash
ros2 run rqt_image_view rqt_image_view

 

출처 :

https://github.com/ros-drivers/usb_cam/tree/ros2?tab=readme-ov-file

 

GitHub - ros-drivers/usb_cam: A ROS Driver for V4L2 USB Cameras

A ROS Driver for V4L2 USB Cameras. Contribute to ros-drivers/usb_cam development by creating an account on GitHub.

github.com

 

'ROS2' 카테고리의 다른 글

[FOXY] rosbag2 개선  (0) 2024.01.22
gscam2  (0) 2024.01.04