当前位置: 首页 > news >正文

VirtualBox虚拟机Ubuntu18.04安装hdl_localization保姆级教程

VirtualBox虚拟机Ubuntu18.04安装hdl_localization保姆级教程

序言

多说一句,好久没登陆csdn,有些文章被设置为VIP什么的,我都不知道,恶心人,这个网站权当是学习记录分享,我本人所有的材料和文章都是开放的,我全给改回来了。

  1. 首先通过虚拟机安装系统,这一步非常简单跳过。

  2. 如果开机遇到时间乱码和终端无法打开的情况,没有直接去3

    • 这是由于系统字符编码设置不正确或语言环境配置错误引起的,老版的bug就是多,处理步骤如下

      • 开机或者进入桌面之后,按下Ctrl + Alt + F3进入命令行界面。

      • #修改编码
        sudo nano /etc/default/locale
        
      • LANG="en_US"修改为LANG="en_US.UTF-8"

      • Ctrl+O写入 然后回车,然后Ctrl+X退出即可

      • 还有一件事,默认创建的用户是没有sudo权限的,你需要给用户添加sudo权限

      sudo usermod -aG sudo 用户名
      #执行完以后重启系统
      
  3. 给ubuntu配置国内镜像源 或者配置终端代理,不然很慢,可以自己找教程,也可以看我的这个提供一个参考

    1. 替换为国内的镜像源

      #首先备份原来的镜像源文件
      sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak#编辑sources.list,nano或者vim都行,有些没装 我就用nano
      sudo nano /etc/apt/sources.list#将以下内容粘贴到 sources.list 文件中# 清华大学开源软件镜像站
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse#粘贴完成后,保存并退出文件(在 nano 中,按 Ctrl + X,然后按 Y,最后按 Enter)#最后到终端
      sudo apt update
      
    2. 给终端配置代理,这个直接在~/.bashrc里面导入代理配置就好,但是ubuntu18时候会有bug,sudo的时候不会继承配置文件里面的变量,直接清掉了。所以最好直接给apt配置代理,操作如下。

      #编辑~/.bashrc里面,在末尾添加如下,具体看你自己的代理配置# HTTP/HTTPS代理
      export http_proxy="http://192.168.124.9:7897"
      export https_proxy="http://192.168.124.9:7897"
      

      如果这时候sudo apt install 没有超时那就可以,如果不行就需要给apt配置代理。这大概sudo的时候没走这个代理,但如果你切换root就可以,但我们不希望这样。我们给apt配置代理 一劳永逸

      #编辑apt的代理文件,如果没有就自己创建这个
      sudo nano /etc/apt/apt.conf.d/proxy.conf#里面添加如下内容,具体的代理根据自己的配置
      Acquire::http::Proxy "http://127.0.0.1:7890";
      Acquire::https::Proxy "http://127.0.0.1:7890";
      
  4. OK,如果安装软件没问题的话,下面的都给装上

    sudo apt install git make cmake gcc g++ 
    
  5. 按照koide3/hdl_localization的指示,创建文件夹,并下载好这几个git仓库

    1. mkdir -p catkin_ws/srcgit clone https://github.com/koide3/ndt_omp
      git clone https://github.com/SMRT-AIST/fast_gicp --recursive
      git clone https://github.com/koide3/hdl_localization
      git clone https://github.com/koide3/hdl_global_localizationcd catkin_wscatkin_make -DCMAKE_BUILD_TYPE=Release
      
  6. 执行完上面的命令,不出意外应该会报错,大概是下面的这个样子,执行提示的命令没有用,其实就是ros没装好,我们安装ros

    #可能是这样
    Unable to handle package.xml format version '3', please update catkin_pkg (e.g. on Ubuntu/Debian use: sudo apt-get update && sudo apt-get install --only-upgrade python-catkin-pkg)
    
  7. 安装ROS

    1. 添加ros源

      1. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list'
        
      2. 添加ros公钥

        1. sudo apt install curl -y
          curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
          
      3. 更新apt并安装ros

        1. sudo apt install ros-melodic-desktop-full
          
      4. 如果安装的时候出现报错,下面这样的话,这是大概率是依赖冲突

        1. Errors were encountered while processing:/tmp/apt-dpkg-install-PLnypS/0692-python-catkin-pkg-modules_0.5.2-1_all.deb
          E: Sub-process /usr/bin/dpkg returned an error code (1)
          
        2. 可以这样解决

          1. #清理apt的缓存
            sudo apt clean
            sudo apt update#修复损坏依赖
            sudo apt --fix-broken install#一般执行完上面应该没啥问题,不过还不行 直接强制安装
            sudo apt install --reinstall python-catkin-pkg-modules
            
  8. 结束之后查看ros是否安装,如果没有输出,请查看前面是不是哪里没搞对

    1. dpkg -l | grep ros-melodic-catkin
      

      这时候还是不可以直接catkin,需要先加载一下ros环境

      #加载ros环境
      source /opt/ros/melodic/setup.bash#我们可以直接写入bashrc,不然每次都得source很麻烦
      echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
      source ~/.bashrc
      

      这个时候catkin_make -DCMAKE_BUILD_TYPE=Release编译就没啥问题了,如果遇到这个问题,就是内存不够了,减少编译的线程数就可以了,这样操作catkin_make -DCMAKE_BUILD_TYPE=Release -j2

      make[1]: *** Waiting for unfinished jobs....
      [ 75%] Linking CXX executable /home/dpf/Workspace/catkin_ws/devel/lib/hdl_global_localization/hdl_global_localization_node
      [ 75%] Built target hdl_global_localization_node
      [ 77%] Linking CXX shared library /home/dpf/Workspace/catkin_ws/devel/lib/libfast_gicp.so
      [ 77%] Built target fast_gicp
      Makefile:140: recipe for target 'all' failed
      make: *** [all] Error 2
      Invoking "make -j14 -l14" failed
      
http://www.dtcms.com/a/330781.html

相关文章:

  • 【自动化运维神器Ansible】template模块深度解析:动态配置文件生成的艺术
  • RxJava Android 创建操作符实战:从数据源到Observable
  • 十一,算法-快速排序
  • 大带宽服务器具体是指什么?
  • 十分钟学会一个算法 —— 快速排序
  • 【03】VMware安装麒麟操作系统kylin10sp3
  • Docker运行python项目:使用Docker成功启动FastAPI应用
  • vue3+leaflet案例:告警系统GIS一张图(附源码下载)
  • Mybatis实现页面增删改查
  • 服务器的定义-哈尔滨云前沿
  • [机器学习]07-基于多层感知机的鸢尾花数据集分类
  • Effective Java笔记:要在公有类而非公有域中使用访问方法
  • 解决Maven编译时JAVA_HOME配置错误问题:从报错到根治的完整方案
  • 自动驾驶与人形机器人的技术分水岭
  • springboot博客实战笔记02
  • React.memo、useMemo 和 React.PureComponent的区别
  • 智慧城市SaaS平台/专项管理系统
  • 板子识别出来的所有端点号等信息
  • C++中的链式操作原理与应用(三):专注于异步操作延的C++开源库 continuable
  • 决策树 >> 随机森林
  • 智慧工地从工具叠加到全要素重构的核心引擎
  • Claude Code频繁出错怎么办?深入架构层面的故障排除指南
  • 【Linux学习|黑马笔记|Day4】IP地址、主机名、网络请求、下载、端口、进程管理、主机状态监控、环境变量、文件的上传和下载、压缩和解压
  • 【论文阅读】基于表面肌电信号的下肢多关节运动估计:一种深度卷积神经网络方法
  • [小练习]生成54张扑克牌,洗牌。
  • 解决 VSCode 运行 Python 时 ModuleNotFoundError: No module named ‘open_webui‘ 问题
  • 三角洲知识点
  • CI/CD流水线搭建流程
  • 药房发药的“时间密码”:同步时钟用药安全?
  • 抗辐照CANFD通信芯片在高安全领域国产化替代的研究