astra 安装
- 编译会报错
Could not find a package configuration file provided by "libuvc" with anyof the following names:libuvcConfig.cmakelibuvc-config.cmake
解决方法:
git clone https://github.com/libuvc/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make && sudo make install
但是cmake … 报如下错误.
-- Checking for module 'libusb-1.0'
-- No package 'libusb-1.0' 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)cmake/FindLibUSB.cmake:18 (pkg_check_modules)CMakeLists.txt:42 (find_package)
解决办法如下;
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
编译ros_astra_camera 包的时候会出现一大段报错问题,这样的一堆…
[ 88%] Linking CXX executable /home/ubuntu/noetic/catkin_ws/devel/lib/astra_camera/camera_node
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/…/…/…/aarch64-linux-gnu/Scrt1.o: in function _start': (.text+0x18): undefined reference to
main’
/usr/bin/ld: (.text+0x1c): undefined reference to main' /usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function
libuvc_camera::CameraDriver::~CameraDriver()‘:
camera_driver.cpp:(.text+0xb98): undefined reference to uvc_free_frame' /usr/bin/ld: camera_driver.cpp:(.text+0xbb4): undefined reference to
uvc_exit’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::getUVCExposureCb(astra_camera::GetUVCExposureRequest_<std::allocator<void> >&, astra_camera::GetUVCExposureResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0xd1c): undefined reference to
uvc_get_exposure_abs’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::setUVCExposureCb(astra_camera::SetUVCExposureRequest_<std::allocator<void> >&, astra_camera::SetUVCExposureResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0xdbc): undefined reference to
uvc_set_ae_mode’
/usr/bin/ld: camera_driver.cpp:(.text+0xdd4): undefined reference to uvc_set_ae_mode' /usr/bin/ld: camera_driver.cpp:(.text+0xf30): undefined reference to
uvc_set_exposure_abs’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::getUVCGainCb(astra_camera::GetUVCGainRequest_<std::allocator<void> >&, astra_camera::GetUVCGainResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0xfdc): undefined reference to
uvc_get_gain’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::setUVCGainCb(astra_camera::SetUVCGainRequest_<std::allocator<void> >&, astra_camera::SetUVCGainResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0x1064): undefined reference to
uvc_set_gain’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::getUVCWhiteBalanceCb(astra_camera::GetUVCWhiteBalanceRequest_<std::allocator<void> >&, astra_camera::GetUVCWhiteBalanceResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0x10bc): undefined reference to
uvc_get_white_balance_temperature’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::setUVCWhiteBalanceCb(astra_camera::SetUVCWhiteBalanceRequest_<std::allocator<void> >&, astra_camera::SetUVCWhiteBalanceResponse_<std::allocator<void> >&)': camera_driver.cpp:(.text+0x1144): undefined reference to
uvc_set_white_balance_temperature_auto’
/usr/bin/ld: camera_driver.cpp:(.text+0x115c): undefined reference to uvc_set_white_balance_temperature_auto' /usr/bin/ld: camera_driver.cpp:(.text+0x117c): undefined reference to
uvc_set_white_balance_temperature’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::Start()': camera_driver.cpp:(.text+0x1204): undefined reference to
uvc_init’
/usr/bin/ld: camera_driver.cpp:(.text+0x1224): undefined reference to uvc_perror' /usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function
libuvc_camera::CameraDriver::Stop()‘:
camera_driver.cpp:(.text+0x13c4): undefined reference to uvc_exit' /usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function
libuvc_camera::CameraDriver::ReconfigureCallback(libuvc_camera::UVCCameraConfig&, unsigned int)’:
camera_driver.cpp:(.text+0x1534): undefined reference to uvc_set_scanning_mode' /usr/bin/ld: camera_driver.cpp:(.text+0x16c4): undefined reference to
uvc_set_ae_mode’
/usr/bin/ld: camera_driver.cpp:(.text+0x184c): undefined reference to uvc_set_ae_priority' /usr/bin/ld: camera_driver.cpp:(.text+0x19e4): undefined reference to
uvc_set_exposure_abs’
/usr/bin/ld: camera_driver.cpp:(.text+0x1b84): undefined reference to uvc_set_focus_auto' /usr/bin/ld: camera_driver.cpp:(.text+0x1d10): undefined reference to
uvc_set_focus_abs’
/usr/bin/ld: camera_driver.cpp:(.text+0x1e98): undefined reference to uvc_set_gain' /usr/bin/ld: camera_driver.cpp:(.text+0x2024): undefined reference to
uvc_set_iris_abs’
/usr/bin/ld: camera_driver.cpp:(.text+0x21ac): undefined reference to uvc_set_brightness' /usr/bin/ld: camera_driver.cpp:(.text+0x2350): undefined reference to
uvc_set_pantilt_abs’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::ImageCallback(uvc_frame*)': camera_driver.cpp:(.text+0x2954): undefined reference to
uvc_yuyv2bgr’
/usr/bin/ld: camera_driver.cpp:(.text+0x2974): undefined reference to uvc_perror' /usr/bin/ld: camera_driver.cpp:(.text+0x29fc): undefined reference to
uvc_mjpeg2rgb’
/usr/bin/ld: camera_driver.cpp:(.text+0x2a1c): undefined reference to uvc_perror' /usr/bin/ld: camera_driver.cpp:(.text+0x2a94): undefined reference to
uvc_any2bgr’
/usr/bin/ld: camera_driver.cpp:(.text+0x2ab4): undefined reference to uvc_perror' /usr/bin/ld: camera_driver.cpp:(.text+0x2e3c): undefined reference to
astraWithUVC(OB_DEVICE_NO)’
/usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function libuvc_camera::CameraDriver::OpenCamera(libuvc_camera::UVCCameraConfig&)': camera_driver.cpp:(.text+0x3cec): undefined reference to
uvc_find_devices’
/usr/bin/ld: camera_driver.cpp:(.text+0x3d0c): undefined reference to uvc_perror' /usr/bin/ld: camera_driver.cpp:(.text+0x3d84): undefined reference to
uvc_unref_device’
/usr/bin/ld: camera_driver.cpp:(.text+0x3ef8): undefined reference to uvc_open' /usr/bin/ld: camera_driver.cpp:(.text+0x4024): undefined reference to
uvc_get_bus_number’
/usr/bin/ld: camera_driver.cpp:(.text+0x4038): undefined reference to uvc_get_device_address' /usr/bin/ld: camera_driver.cpp:(.text+0x4184): undefined reference to
uvc_get_bus_number’
/usr/bin/ld: camera_driver.cpp:(.text+0x4198): undefined reference to uvc_get_device_address' /usr/bin/ld: camera_driver.cpp:(.text+0x41a8): undefined reference to
uvc_strerror’
/usr/bin/ld: camera_driver.cpp:(.text+0x4208): undefined reference to uvc_unref_device' /usr/bin/ld: camera_driver.cpp:(.text+0x4228): undefined reference to
uvc_set_status_callback’
/usr/bin/ld: camera_driver.cpp:(.text+0x4290): undefined reference to uvc_get_stream_ctrl_format_size' /usr/bin/ld: camera_driver.cpp:(.text+0x42b8): undefined reference to
uvc_perror’
/usr/bin/ld: camera_driver.cpp:(.text+0x42c4): undefined reference to uvc_close' /usr/bin/ld: camera_driver.cpp:(.text+0x42d0): undefined reference to
uvc_unref_device’
/usr/bin/ld: camera_driver.cpp:(.text+0x4408): undefined reference to uvc_print_diag' /usr/bin/ld: camera_driver.cpp:(.text+0x4430): undefined reference to
uvc_start_streaming’
/usr/bin/ld: camera_driver.cpp:(.text+0x4450): undefined reference to uvc_perror' /usr/bin/ld: camera_driver.cpp:(.text+0x445c): undefined reference to
uvc_close’
/usr/bin/ld: camera_driver.cpp:(.text+0x4468): undefined reference to uvc_unref_device' /usr/bin/ld: camera_driver.cpp:(.text+0x4488): undefined reference to
uvc_free_frame’
/usr/bin/ld: camera_driver.cpp:(.text+0x44b0): undefined reference to uvc_allocate_frame' /usr/bin/ld: CMakeFiles/camera_node.dir/src/libuvc_camera/camera_driver.cpp.o: in function
libuvc_camera::CameraDriver::CloseCamera()‘:
camera_driver.cpp:(.text+0x4644): undefined reference to uvc_close' /usr/bin/ld: camera_driver.cpp:(.text+0x4658): undefined reference to
uvc_unref_device’
collect2: error: ld returned 1 exit status
make[2]: *** [depth_camera/ros_astra_camera/CMakeFiles/camera_node.dir/build.make:150: /home/ubuntu/noetic/catkin_ws/devel/lib/astra_camera/camera_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:4581: depth_camera/ros_astra_camera/CMakeFiles/camera_node.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
看一下就是找不到库的问题,解决这个问题的方法是修改ros_astra_camera的CmakeList.txt文件。(入行小白一开始很头大,因为不熟悉Cmake语法,后来看了几天之后凭感觉学会了,我真是个天才,哈哈飘了)咳咳,直接关注问题本身。
Cmakelist中的添加libuvc是通过find_package(libuvc REQUIRED) 寻找库的,但是新安装的libuvc 0.0.6 没有生成 libuvc.cmake文件(不知道原因),所以编译时libuvc_INCLUDE_DIRS、libuvc_LIBRARIES 都是空的!!! 所以编译才找不到对应的库!
解决办法:在ros_astra_camera的CmakeList.txt文件的find_package(libuvc REQUIRED)下方添加两条语句(根据你libuvc安装的地址修改),编译就OK了
set(libuvc_INCLUDE_DIRS “/usr/local/include/libuvc”)
set(libuvc_LIBRARIES “/usr/local/lib/libuvc.so”)
find_package(libuvc REQUIRED) #原因是libuvc库存在问题,没有libuvc.cmake文件,find_package()无法找到libuvc库文件
#解决办法手动添加库文件位置
set(libuvc_INCLUDE_DIRS "/usr/local/include/libuvc")
set(libuvc_LIBRARIES "/usr/local/lib/libuvc.so")