一、ros-foxy usb相机驱动安装
新建终端输入以下命令即可完成安装:
// An highlighted block
sudo apt-get install ros-foxy-v4l2-camera ;
二、运行测试
终端运行以下命令:
// An highlighted block
ros2 run v4l2_camera v4l2_camera_node ;
三、安装image_pipeline图像管道
1.终端克隆功能包
// 选择对应ros版本的分支下载,我这里是foxy分支
git clone https://github.com/ros-perception/image_pipeline.git -b foxy ;
2.编译
// An highlighted block
colcon build --symlink-install --packages-select image_pipeline ;
注意:ERROR:colcon.colcon_cmake.task.cmake.build:Failed to find the following files:
Check that the following packages have been built:
tracetools_image_pipeline
如果在构建过程中出现错误,提示在系统上是否尚未构建camera_calibration、depth_image_proc、image_proc、 image_publisher、image_rotate、image_view、stereo_image_proc软件包,则需要先构建这些软件包,命令为:
// 将错误中的tracetools_image_pipeline包加入创建
colcon build --packages-select camera_calibration depth_image_proc image_proc image_publisher image_rotate image_view stereo_image_proc tracetools_image_pipeline ;
构建好这些软件包后再运行:
// An highlighted block
colcon build --symlink-install --packages-select image_pipeline ;
编译成功!!!!
四、设置环境
// An highlighted block
echo “source ~/wgl_ws/install/setup.bash” >> .bashrc ;
五、启动驱动程序
// An highlighted block
ros2 run v4l2_camera v4l2_camera_node --ros-args -p video_device:="/dev/video0" -p image_size:=[640,480] ;