SLAM踩坑记录 | 编译框架 | 配置环境等

本文主要是记录个人在学习SLAM过程中遇到的坑及解决办法,仅供参考

30、编译Limo遇到问题:

  • 1、error: expected constructor, destructor, or type conversion before ‘(’ token PLUGINLIB_DECLARE_CLAS
  • 【解决】:是由于pluginlib新版插件抛弃了PLUGINLIB_DECLARE_CLAS,使用了PLUGINLIB_EXPORT_CLASS(),后者只需要两个参数。所以只需要把报错的语句改成:
//PLUGINLIB_DECLARE_CLASS(image_preproc_ros_tool, ResizeNodelet,
//                        image_preproc_ros_tool::ResizeNodelet, nodelet::Nodelet);
PLUGINLIB_EXPORT_CLASS(image_preproc_ros_tool::ResizeNodelet, nodelet::Nodelet);
  • 2、出现Eigen头文件链接问题:
  • 【解决】链接eigen到 /usr/include
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

2020/6/13重装系统问题:-----------------------

当你很辛苦把分区什么的都设置好了之后,在输入了系统名字,开机密码那几项之后,再选择地点的时候(如:选择 “上海”),然后就会卡死,然后,闪退到最原始的界面,即刚开始进去安装镜像的那个界面,怎么回事呢?

答曰:将网线拔掉(即:装Linux时,千万不要联网)就可以了,一切顺利,浪费了很长时间解决这个问题。

以为是系统镜像问题,重新做了多少次系统启动盘;以为是显卡问题,拔掉显卡重新装,还是这样子;曾以为是主板问题。是:网线的问题。装Linux时,千万不要联网

重装显卡驱动问题:

// 禁用nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
// 加上
blacklist nouveau
//最后输入使之生效
sudo update-initramfs -u 

然后开始装nvidia驱动

2020/6/11:ROS rosdep update问题-----------------------

27、如果提示的是 ERROR: unable to process source https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/xxxxx 之类的错误,同时保证自己机器可以上百度的前提下,此时可能是因为raw.githubusercontent.com网站被墙了。

解决办法是修改hosts文件,添加这个网站的ip地址

#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133  raw.githubusercontent.com
#保存后退出再尝试

2020/6/8:编译demo_lidar时遇到pcl的错误-----------------------

26、打印话题的frame_id,在rviz中的Fixed Frame中使用:
rostopic echo /话题名称 | grep frame_id
27、在CMakeLists.txt中添加pcl 1.8的链接:
find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

28、error: ‘fromROSMsg’ is not a member of ‘pcl’。

将 #include 改成

#include 

2020/6/7:编译LIMO报错-----------------------

23、Ubuntu16.04下编译LIMO报错,Error:Version in “./docker-compose.yml” is unsupported. You might be seeing this error because you’re using the wrong Compose file version…
【解决】:docker compose将解析版本为"2",而不是"3.4"。应该改为:
version: "2"
24、在Ubuntu14.04下编译indigo的ros包工作空间,先使用catkin_make;再source devel/setup.bash;最后再rosmake <包名称>
25、编译opencv2.4版本时:遇到…/modules/contrib/src/rgbdodometry.cpp:65:47:fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
【解决】:在rgbdodometry.cpp的65加上eigen3
include <eigen3/unsupported/Eigen/MatrixFunctions>

2020/6/5:整理之前配置库的命令-----------------------

22、整理之前配置库的命令(ubuntu16.04):
配置opencv3.4.3及其扩展库
1.
mkdir release

2.
cmake -D CMAKE_BUILD_TYPE=RELEASE -DBUILD_TIFF=ON -DCMAKE_INSTALL_PREFIX=/usr/local PYTHON3_EXECUTABLE=/usr/bin/python3.5 PYTHON_INCLUDE_DIR=/usr/include/python3.5 PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.3/modules ..

3.
sudo make 

4.
sudo make install

{
//切换版本
CMAKE_MINIMUM_REQUIRED( VERSION 2.8)
PROJECT(useOpenCV)
set(OpenCV_DIR "usr/local/share/OpenCV") // 设置opencv路径来切换版本
FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
add_executable(useOpenCV useOpenCV.cpp)
TARGET_LINK_LIBRARIES(useOpenCV ${OpenCV_LIBRARIES})
}

配置pcl库
//依赖
     sudo apt-get update
     sudo apt-get install git build-essential linux-libc-dev
     sudo apt-get install cmake cmake-gui 
     sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
     sudo apt-get install mpi-default-dev openmpi-bin openmpi-common  
     sudo apt-get install libflann1.8 libflann-dev
     sudo apt-get install libeigen3-dev
     sudo apt-get install libboost-all-dev
     sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
     sudo apt-get install libqhull* libgtest-dev
     sudo apt-get install freeglut3-dev pkg-config
     sudo apt-get install libxmu-dev libxi-dev 
     sudo apt-get install mono-complete
     sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre
//下载
	git clone https://github.com/PointCloudLibrary/pcl.git
//编译
     cd pcl
     mkdir release
     cd release
     cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \
           -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON \
           -DCMAKE_INSTALL_PREFIX=/usr ..    
     make
	 sudo make install

//CMakeLists.txt

find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

21、目前ubuntu16.04使用的源(中科大):

sudo gedit /etc/apt/sources.list
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse #Added by software-properties

20、sudo apt-get update 时报错:Failed to fetch http://…

【解决】 : 将设置更新里的other sorftware相关的链接关掉或删掉,然后重新reload

2020/5/30:编译SegMap-----------------------

16、metis-5.1.0.tar.gz链接不上,

  • 将其下载下来解压,放到SegMap/build/metis_catkin/metis_src-prefix/src/metis_src下,然后,注掉/SegMap/src/metis_catkin/CMakeLists.txt里的
#set(METIS_URL https://github.com/ethz-asl/thirdparty_library_binaries/raw/master/metis-5.1.0.tar.gz)
    #URL ${METIS_URL}
    #URL ${METIS_URL}
boost相关
  • 查看boost版本号:
dpkg -s libboost-dev | grep 'Version'
  • 编译boost:
./bootstrap.sh
sudo ./b2
sudo ./b2 install
  • 删除boost:
sudo rm -rf /usr/local/lib/libboost_*
sudo rm -rf /usr/local/include/boost/
  • proxy_addr报错是代理设置问题,取消代理设置(在设置中把代理设置为None)
  • tensorflow和cuda等版本对照表:SLAM踩坑记录 | 编译框架 | 配置环境等_第1张图片

17、gtsam编译时:undefined to boost::arvc…

【解决】:将gtsam_catkin下面的CMakeList.txt修改如下(修改gtsam的源):
include(ExternalProject)
file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/include)
ExternalProject_Add(gtsam_src
  GIT_REPOSITORY https://github.com/borglab/gtsam.git
  #GIT_TAG 687ae3d2511b9c296af08ec2f2e717b0627a8d68
  #GIT_TAG 4.0.0
  UPDATE_COMMAND ""
  PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/use_catkinized_metis.patch &&
                patch -p1 < ${CMAKE_SOURCE_DIR}/fix_warnings.patch
  CONFIGURE_COMMAND cmake -DCMAKE_INSTALL_PREFIX:PATH=${CATKIN_DEVEL_PREFIX} -DGTSAM_USE_SYSTEM_EIGEN=ON
  -DCMAKE_BUILD_TYPE=Release ../gtsam_src
  BUILD_COMMAND make -j2
  INSTALL_COMMAND make install
)

18、编译segmap下载第三方库慢:参考https://blog.csdn.net/xy_zhangchn/article/details/81558144

  • git clone 时需要输入密码,直接将git clone的链接改为:
https://username:password@github.com
或者   https://username:password@gitee.com

19、PCL1.8和boost1.58有冲突,改用boost1.66

2020/5/29:(编译segmap,源码安装tensorflow 1.8.0)-----------------------

  • 清除bazel编译的命令:
bazel clean --expunge
  • 链接库命令:
sudo ln -s 源文件 目标文件
  • 寻找某个文件命令:
sudo find / -name "cc1plus"
  • bazel执行编译tensorflow:
bazel build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
  • 切换gcc版本:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
sudo update-alternatives --config gcc
  • 【以上源码安装未成功,需要梯子,有些包下载不下来。改用pip,尝试编译segmap】

2020/5/21:代理-----------------------

15、设置代理后,ubuntu终端中git联不上。sudo gedit ~/.gitconfig 然后删除代理https_proxy等。

===================================================

1、报错:

  • void Eigen::MapBase::checkSanity() const [with Derived = Eigen::Map, 32, Eigen::Stride<0, 0> >]: Assertion `((size_t(m_data) % (((int)1 >= (int)internal::traits::Alignment) ? (int)1 : (int)internal::traits::Alignment)) == 0) && “data is not aligned”’ failed.
【解决】:把debug改成release模式

2、编译vins-fusion遇到的问题:

  • No rule to make target ‘/usr/lib/x86_64-linux-gnu/libtbbmalloc.so’
【解决】:
sudo ln -s 
sudo ln -s /usr/lib/x86_64-linux-gnu/libtbbmalloc.so.2 /usr/lib/x86_64-linux-gnu/libtbbmalloc.so

3、换显示器电脑无线重启解决办法

sudo apt-get remove --purge nvidia*
sudo apt-get autoremove
sudo /usr/bin/nvidia-uninstall
sudo service lightdm stop
sudo ./NVIDA-Linux-         --dkms --no-opengl-files
reboot

【备注】:dkms 最好选yes;32位兼容最好选yes;x-org最好选no。此处–no-opengl-files意思是不使用GPU对openGL加速,而是使用CPU核显。如果想使用GPU加速桌面及软件的话就去掉

4、安装MSCKF。发现rqt的插件没安装。但是安装时发现连接不到源。update有报错,amd64 package not found。

重新添加ros的源及key

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

5、电脑根目录突然被占满,发现时/var/log/cups占满了。删除即可

sudo rm -rf /var/log/cups
sudo service cups stop
sudo chmod 000 /usr/sbin/cupsd

6、出现:/usr/bin/ld: cannot find –luuid

解决办法:手动链接库

ln –s libuuid.so.1.3.0 libuuid.so

7、编译pl-slam出现问题:

1、error: ‘random_device’ was not declared in this scope
【解决】:在头文件加上 #include
2、error: no match for ‘operator=’ (operand types are ‘mrpt::poses::CPose3D’ and ‘mrpt::math::TPose3D’)
【解决】:改成:

pose_gt = CPose3D(TPose3D(v_auxgt(0),v_auxgt(1),v_auxgt(2),v_auxgt(3),v_auxgt(4),v_auxgt(5)));

8、错误:重新编译yaml-cpp之后发现rviz不能用。

【解决】:yaml-cpp.so.0.5.2安装到:

set(LIB_INSTALL_DIR “/usr/lib/x86_64-linux-gnu”)

然后将home下的.rviz文件全部删除,再重新运行rviz即可

9、错误:Chessboard.cc.o: relocation R_X86_64_32 against `.rodata’ can not be used when making a shared object; recompile with -fPIC

【解决】:添加 -fPIC -shared 。并且重启vscode

10、错误:遇到libgflags.a(gflags.cc.o): relocation R_X86_64_32 against `.rodata.str1.1’ ca时

【解决】: 把glfag编译成动态库,在其CMakeLists.txt里面将Shared lib 置ON

11、编译stvo-pl错误:undefined reference to boost::re_detail_106600::cpp_regex_traits_implementation::transform(char const*, char const*) const’

【解决】:删除build后,执行./build.sh

12、错误:ubuntu下Matlab中文乱码:

【解决】:
Windows下.m文件编码不是utf-8,需要转换
安装enca:

sudo apt install enca

在对应文件夹下把所有.m 文件转换过来

~$ enca -L zh_CN -x utf-8 *.m

没有中文字体
为系统安装中文字体,
在matlab设置中为编辑器(editor)选择对应字体即可

13、港科大kidnap的安装与使用(遇到的问题)

  • 报错:/oiio/src/libutil/strutil.cpp: In function ‘void OpenImageIO::v1_7::Strutil::utf8_to_unicode(OpenImageIO::v1_7::string_view, std::vector&)’:
    /home/why/SLAM_WS/Kidnap/src/oiio/src/libutil/strutil.cpp:877:23: error: ‘codepoint’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    (byte & 0x3fu) | (*codep << 6) :
  • 【解决】:这是由于没有给指针分配内存,修改src/libutil/strutil.cpp第886行如下:
void
Strutil::utf8_to_unicode (string_view str, std::vector<uint32_t> &uvec)
{
    const char* begin = str.begin();
    const char* end = str.end();
    uint32_t state = 0;
    for (; begin != end; ++begin) {
        uint32_t codepoint;
        if (!decode(&state, &codepoint, (unsigned char) *begin))
            uvec.push_back(codepoint);
    }
}

依赖:OpenExr2.2

14、编译OpenCV3.4.3 :opencv2/xfeatures2d/cuda.hpp: No such file or directory 类问题的解决方法

【解决】:将其改为绝对路径。(由于opencv_contrib-3.4.3 和 opencv-3.4.3是分开的,之前的相对路径都错了)
参考:https://blog.csdn.net/weixin_44152895/article/details/102882502

出现 编译OpenCV 以及 openc_contrib 提示缺少boostdesc_bgm.i文件出错的解决:

【参考】https://blog.csdn.net/u011736771/article/details/85960300

你可能感兴趣的:(SLAM)