参考https://blog.csdn.net/weixin_48657767/article/details/126054121?spm=1001.2014.3001.5502
![](https://img-blog.csdnimg.cn/img_convert/970c51c8c4a6f8903e6b37f0c9e21295.png)
cmake编译时有bug,缺包,安装对应的包
![](https://img-blog.csdnimg.cn/img_convert/8c808ed74949fdda832c63d50eac5466.png)
sudo apt-get install ros-melodic(对应ros版本)-****(对应包名,下划线变中线)
sudo apt-get install ros-melodic-camera-info-manager
![](https://img-blog.csdnimg.cn/img_convert/5bcaf2549f4827006a7e30d0e7f2c457.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://img-blog.csdnimg.cn/img_convert/1b6b24d63bd52cf454e5bd520cb37211.png)
修改lauch文件夹下的usb_cam.launch文件中的参数,打开usb相机右侧摄像头
<param name="video_device" value="/dev/video2" />
![](https://img-blog.csdnimg.cn/img_convert/86df5a00650d52162319ed8361039d1b.png)
0:笔记本摄像头;2:外接usb相机(右侧)摄像头;4:受损画质(猜测是摄像头受损)
![](https://img-blog.csdnimg.cn/img_convert/74df370a4a65647c095e8d14effcea39.png)