https://github.com/ros-drivers/usb_cam
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
위 github 참고.
version
* Ubuntu22.04
* ROS2 Humble
Quickstart
sudo apt-get install ros-<ros2-distro>-usb-cam
*humble 버전
sudo apt-get install ros-humble-usb-cam
Building from Source
cd /colcon_ws/src
git clone https://github.com/ros-drivers/usb_cam.git
cd /colcon_ws
rosdep install --from-paths src --ignore-src -y
ROS 패키지 의존성 설치
cd /colcon_ws
colcon build
source /colcon_ws/install/setup.bash
Running
ros2 run usb_cam usb_cam_node_exe
* 자동으로 뜨는 카메라 설정하고 싶을때
/colcon_ws/src/usb_cam/src/ros2/usb_cam_node.cpp 들어가서 this->declare_parameter("video_device", "/dev/video4");
뒤에 포트번호만 바꾸고 colcon_ws/ 경로에서 colcon build하면 됨.
ros2 launch usb_cam camera.launch.py
*ros2 humble, ubuntu22.04 환경에서 오류 발생
error_code
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught multiple exceptions when trying to load file of format [py]: - PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True. Note that @root_validator is deprecated and should be replaced with @model_validator.
밑에 링크 참조.
https://qlalf-smithy.tistory.com/38
ROS2_USB_Cam_Error(@root_validator)
https://qlalf-smithy.tistory.com/34 ROS2_usb_cam 설치https://github.com/ros-drivers/usb_cam GitHub - ros-drivers/usb_cam: A ROS Driver for V4L2 USB CamerasA ROS Driver for V4L2 USB Cameras. Contribute to ros-drivers/usb_cam development by creating an a
qlalf-smithy.tistory.com
Launching Multiple usb_cam's
# /usb_cam/config/params_1.yaml 과 /usb_cam/config/params_2.yaml 들어가서 본인이 키고싶은 카메라에 맞는 포트번호 수정 (/dev/video1)
ros2 run usb_cam usb_cam_node_exe --ros-args --remap __ns:=/usb_cam_1 --params-file /본인경로/colcon_ws/src/usb_cam/config/params_1.yaml
ros2 run usb_cam usb_cam_node_exe --ros-args --remap __ns:=/usb_cam_2 --params-file /본인경로/colcon_ws/src/usb_cam/config/params_2.yaml
추가
1. usb_cam /dev/video
ls -ltr /dev/video*
*cmd 창에 해당 명령어 치면, pc에 연결된 모든 카메라 포트 번호 생성. 이때 본인은 video0,1 은 내장 포트번호/ 3,4는 usb 연결 캠/ 5,6 은 c타입 연결 캠 포트번호로 뜸
'Ubuntu > ROS' 카테고리의 다른 글
Stereo_Camera_Calibration feat.USB_CAM (0) | 2024.08.17 |
---|---|
ROS2_USB_Cam_Error(@root_validator) (0) | 2024.08.17 |
Camera_parameter feat.calibration (0) | 2024.08.11 |
Ros2_usb_cam_오류수정 (0) | 2024.08.11 |
Ubuntu20.04_ROS1 noetiec & ROS2 foxy Install 설치 (둘다 사용) (2) | 2024.02.23 |