当前位置:   article > 正文

ubuntu22.04运行VINS-Mono_vins-mono运行

vins-mono运行

此文档记录了如何在ubuntu 22.04中使用docker(ubuntu 18.04) + ROS进行VINS-Mono实验。

1.安装Docker

https://docs.docker.com/desktop/install/ubuntu/

2.运行docker container

  1. 可以通过在宿主机安装xserver,将docker容器视为客户端,
  2. 通过网络或挂载的方式就可以实现将需要显示的图像显示在宿主机显示器。
  3. 网络方式:
  4. A.在宿主机
  5. 查看宿主机IP
  6. $ ifconfig ##假设为xxx.xxx.xxx.xx
  7. 查看当前显示的环境变量值
  8. $ echo $DISPLAY (要在显示屏查看,其他ssh终端不行) ##假设为:0
  9. 或通过socket文件分析:
  10. $ ll /tmp/.X11-unix/ ##假设为X0= ---> :0
  11. 安装xserver
  12. $ sudo apt install x11-xserver-utils
  13. $ sudo vim /etc/lightdm/lightdm.conf
  14. 增加许可网络连接
  15. [SeatDefaults]
  16. xserver-allow-tcp=true
  17. 重启xserver
  18. $ sudo systemctl restart lightdm
  19. 许可所有用户都可访问xserver
  20. xhost +
  21. B.在docker 容器内
  22. # export DISPLAY=xxx.xxx.xxx.xx:0
  23. 注意:环境变量设置需要每次进docker设置,可以写在:/etc/bash.bashrc 文件中,避免每次进终端时设置
  24. 挂载方式:
  25. A.在宿主机
  26. 查看宿主机IP
  27. $ ifconfig ##假设为xxx.xxx.xxx.xx
  28. 查看当前显示的环境变量值
  29. $ echo $DISPLAY (要在显示屏查看,其他ssh终端不行) ##假设为:0
  30. 或通过socket文件分析:
  31. $ ll /tmp/.X11-unix/ ##假设为X0= ---> :0
  32. 安装xserver
  33. $ sudo apt install x11-xserver-utils
  34. 许可所有用户都可访问xserver
  35. xhost +
  36. B.在docker 容器创建时
  37. -v /tmp/.X11-unix:/tmp/.X11-unix
  38. -e DISPLAY=:0
  39. 例如:
  40. docker run -itd --name 容器名 -h 容器主机名 --privileged \
  41. -v /tmp/.X11-unix:/tmp/.X11-unix \
  42. -e DISPLAY=:0 镜像名或id /bin/bash
  43. # 建议使用挂载方式
  44. docker pull ubuntu:18.04
  45. docker run -it --name vins2 --privileged -v /home/huangsen:/home/huangsen -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0.0 ubuntu:18.04 /bin/bash
  46. docker exec -it vins2 /bin/bash

3.ROS安装 + VINS编译运行

http://wiki.ros.org/cn/melodic/Installation/Ubuntu

  1. vim /etc/apt/sources.list
  2. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  4. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  6. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  7. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  9. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  11. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  12. # https://blog.csdn.net/Williamcsj/article/details/123384482
  13. apt-get update
  14. apt install lsb-core
  15. sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  16. sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
  17. apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  18. apt update
  19. apt install ros-melodic-desktop-full
  20. apt-get install python-rosdep
  21. rosdep init
  22. rosdep update
  23. echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
  24. source ~/.bashrc
  25. apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
  26. #要安装合适的显卡驱动
  27. apt install nvidia-driver-525
  28. nvidia-smi
  29. #ceres 安装
  30. http://ceres-solver.org/installation.html
  31. cd ~
  32. mkdir -p catkin_ws/src
  33. cd ~/catkin_ws/src
  34. git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
  35. cd ../
  36. catkin_make
  37. source ~/catkin_ws/devel/setup.bash
  38. #Open three terminals, launch the vins_estimator, rviz and play the bag file respectively.
  39. cd ~/catkin_ws
  40. roslaunch vins_estimator euroc.launch
  41. roslaunch vins_estimator vins_rviz.launch
  42. rosbag play YOUR_PATH_TO_DATASET/MH_01_easy.bag

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/1011268
推荐阅读
相关标签
  

闽ICP备14008679号