参考https://blog.csdn.net/weixin_48657767/article/details/126054121?spm=1001.2014.3001.5502
![](https://i-blog.csdnimg.cn/blog_migrate/42526f336ec68583a54f46efeebd700c.png)
cmake编译时有bug,缺包,安装对应的包
![](https://i-blog.csdnimg.cn/blog_migrate/f195ea4493d8ee767d01d6cc377529db.png)
sudo apt-get install ros-melodic(对应ros版本)-****(对应包名,下划线变中线)
sudo apt-get install ros-melodic-camera-info-manager
![](https://i-blog.csdnimg.cn/blog_migrate/07dd184d3d9e32f8513036d3d4dd89ba.png)
使用命令启动摄像头
roslaunch usb_cam usb_cam-test.launch
bug:
ERROR: cannot launch node of type [image_view/image_view]: image_view
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/pilot/camera_ws/src
ROS path [2]=/home/pilot/carla-ros-bridge/catkin_ws/src
ROS path [3]=/opt/ros/melodic/share
需要source设置环境变量,然后安装了image-view,参考此篇教程
![](https://i-blog.csdnimg.cn/blog_migrate/9445a31415553ce1096f3954fadde8ff.png)
修改lauch文件夹下的usb_cam.launch文件中的参数,打开usb相机右侧摄像头
<param name="video_device" value="/dev/video2" />
![](https://i-blog.csdnimg.cn/blog_migrate/e130771f1bc18e1ba0e5db43f3f412cf.png)
0:笔记本摄像头;2:外接usb相机(右侧)摄像头;4:受损画质(猜测是摄像头受损)
![](https://i-blog.csdnimg.cn/blog_migrate/515bbb4f0e681d93d6a50317e263b171.png)