ROS2 打开USB摄像头

1. ROS2用的是 v4l2_camera功能包,不同于ROS1 的USB_CAM。

2.安装相关功能包:

sudo apt install ros--camera-calibration-parsers
sudo apt install ros--camera-info-manager
sudo apt install ros--launch-testing-ament-cmake

3.克隆image_pipeline

git clone https://github.com/ros-perception/image_pipeline.git

 4.编译

colcon build --symlink-install --packages-select image_pipeline
colcon build --packages-select camera_calibration depth_image_proc image_proc image_publisher image_rotate image_view stereo_image_proc

5.设置环境

echo “source ~/dev_ws/install/setup.bash” >> .bashrc

 6.启动驱动程序

ros2 run v4l2_camera v4l2_camera_node --ros-args -p video_device:="/dev/video0" -p image_size:=[640,480]

可能会报错:ros/camera_info/integrated_webcam_h

你可能感兴趣的:(ROS,opencv,矩阵)