参考https://blog.csdn.net/weixin_48657767/article/details/126054121?spm=1001.2014.3001.5502
cmake编译时有bug,缺包,安装对应的包
sudo apt-get install ros-melodic(对应ros版本)-****(对应包名,下划线变中线)
sudo apt-get install ros-melodic-camera-info-manager
使用命令启动摄像头
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://www.cnblogs.com/victorywr/p/15845117.html#:~:text=ERROR%3A%20cannot%20launch%20node%20of%20type%20%5B%26%5D%5B%26image_view%2Fimage_view%5D%3A,image_view%20sudo%20apt-%20get%20install%20ros-kinetic-image-view%20%E9%87%8D%E6%96%B0%E8%BF%90%E8%A1%8Claunch%E6%96%87%E4%BB%B6%E5%B0%B1%E5%8F%AF%E4%BB%A5%E6%AD%A3%E5%B8%B8%E5%BC%B9%E5%87%BA%E6%91%84%E5%83%8F%E5%A4%B4%E5%9B%BE%E5%83%8F%E7%AA%97%E5%8F%A3
修改lauch文件夹下的usb_cam.launch文件中的参数,打开usb相机右侧摄像头
<param name="video_device" value="/dev/video2" />
0:笔记本摄像头;2:外接usb相机(右侧)摄像头;4:受损画质(猜测是摄像头受损)