下载usb-cam放在catkin_ws /src下
在catkin_ws 下编译
catkin_make
出错:
Checking for module ‘libv4l2’
– No package ‘libv4l2’ found
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
usb_cam-develop/CMakeLists.txt:10 (pkg_check_modules)
解决办法:
sudo apt-get install libv4l-dev
Could NOT find image_transport (missing: image_transport_DIR)
– Could not find the required component ‘image_transport’. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by “image_transport”
with any of the following names:
image_transportConfig.cmake
image_transport-config.cmake
Add the installation prefix of “image_transport” to CMAKE_PREFIX_PATH or
set “image_transport_DIR” to a directory containing one of the above files.
If “image_transport” provides a separate development package or SDK, be
sure it has been installed.
Call Stack (most recent call first):
usb_cam-develop/CMakeLists.txt:31 (find_package)
解决办法:
sudo apt-get install ros-noetic-image-transport
Could NOT find camera_info_manager (missing: camera_info_manager_DIR)
– Could not find the required component ‘camera_info_manager’. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by
“camera_info_manager” with any of the following names:
camera_info_managerConfig.cmake
camera_info_manager-config.cmake
Add the installation prefix of “camera_info_manager” to CMAKE_PREFIX_PATH
or set “camera_info_manager_DIR” to a directory containing one of the above
files. If “camera_info_manager” provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
usb_cam-develop/CMakeLists.txt:31 (find_package)
解决办法:
sudo apt-get install ros-noetic-camera-info-manager
source devel/setup.bash
echo "source ~/catkin_ws/devel/setup.sh" >> ~/.bashrc //永久生效环境
进入usb-cam文件夹下
打开终端
mkdir build
cd build
cmake ..
make
测试
roscore
另外一个终端
roslaunch usb_cam usb_cam-test.launch