ROS移植机器人小车(catkin_make过程中碰到的各种小问题)

莫道桑榆晚,为霞尚满天。这篇文章主要讲述ROS移植机器人小车:catkin_make过程中碰到的各种小问题相关的知识,希望能为你提供帮助。


接前面的贴子:
============================

[1%] Building CXX object clbrobot_project/clb_pid/CMakeFiles/pid_listen.dir/src/clbrobot_pid_core.cpp.o
In file included from /home/ubuntu/noetic/catkin_ws/src/clbrobot_project/clb_pid/src/clbrobot_pid_core.cpp:1:
/home/ubuntu/noetic/catkin_ws/src/clbrobot_project/clb_pid/include/clbrobot_pid/clbrobot_pid_core.h:8:10: fatal error: clb_msgs/PID.h: No such file or directory
8 | #include "clb_msgs/PID.h"
|^~~~~~~~~~~~~~~~
compilation terminated.

说明:这个PID.h是由clb_msgs项目生成的,如果这个项目没有在clb_pid项目前编译,就会出现这个问题。
解决办法:
首先单独编译这个包,
catkin_make -DCATKIN_WHITELIST_PACKAGES="clb_msgs"

然后再编译全部的包,
catkin_make -DCATKIN_WHITELIST_PACKAGES=""

这样,程序就能正确链接了。
============================
packet_write_wait: Connection to 192.168.3.93 port 22: Broken pipe
进入服务器,
sudo vim /etc/ssh/sshd_config

将下面的参数修改一下,
ClientAliveInterval 60

重启一下,
systemctl restart sshd

完成。
============================
下面这个问题参考这位小哥的贴子:
??编译ros_astra_camera 出现找不到libucv问题,已经解决_顺德龙卷风的博客-CSDN博客??
除了问题报错,基本照抄,如下,
编译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
【ROS移植机器人小车(catkin_make过程中碰到的各种小问题)】 /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")

解决此问题后还有一个无法看在 rviz 中看到 RGB图像的问题,参考这位小哥的博客他找到了bug并解决了(官方驱动包有问题)
???
============================
本文结束



    推荐阅读