1. 安裝 docker
安裝:
https://www.cnblogs.com/odesey/p/18262624
拉取失敗:
https://www.cnblogs.com/odesey/p/18235889
免sudo 和使用 GPU:
https://www.cnblogs.com/odesey/p/18233348
為了使用 gpu 需要 nvidia 驅動。
注意:代理的 IP 視你的情況而定。
2. 映象
mkdir ~/docker_workspace # 用於將原生代碼對映到 容器中。
docker pull hyeonjaegil/vins-mono:melodic
docker run -it --privileged --network host --gpus all \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY -e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e FASTRTPS_DEFAULT_PROFILES_FILE=/usr/local/share/middleware_profiles/rtps_udp_profile.xml \
--device-cgroup-rule='c 189:* rmw' \
--device=/dev/bus/usb \
-v /dev/*:/dev/* \
-v /etc/localtime:/etc/localtime:ro \
-v ~/.Xauthority:/root/.Xauthority:rw \
-v ~/docker_workspace:/workspace \
--name vins-mono \
hyeonjaegil/vins-mono:melodic /bin/bash
docker run -it --privileged --network host --gpus all
-v /tmp/.X11-unix:/tmp/.X11-unix
-e DISPLAY -e NVIDIA_VISIBLE_DEVICES=all
-e NVIDIA_DRIVER_CAPABILITIES=all
-e FASTRTPS_DEFAULT_PROFILES_FILE=/usr/local/share/middleware_profiles/rtps_udp_profile.xml
-v /dev/:/dev/
-v /etc/localtime:/etc/localtime:ro
-v ~/.Xauthority:/root/.Xauthority:rw
-v ~/docker_workspace:/workspace
--name vins-mono-test
hyeonjaegil/vins-mono:melodic /bin/bash
3. 執行 vins-mono
宿主機:
xhost +
容器:
# 終端1:
cd /workspace/
mkdir -p vins_ws/src
cd vins_ws/src/
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
cd ../
catkin_make
source devel/setup.bash
roslaunch vins_estimator euroc.launch
# 終端2:
docker exec -it vins-mono /bin/bash
cd /workspace/vins_ws/
source devel/setup.bash
roslaunch vins_estimator vins_rviz.launch
# 終端3:
docker exec -it vins-mono /bin/bash
rosbag play /workspace/datasets/MH_01_easy.bag
euroc 資料集就可以跑起來了。
3. docker 安裝海康工業相機驅動
下載海康工業相機客戶端:
機器視覺工業相機客戶端MVS V2.1.2 (Linux_x86_64)
解壓到: ~/docker_workspace
裡面有很多不同平臺的包。
dpkg -i ./MVS-2.1.1_x86_64_20220511.deb
source ~/.bashrc # 一定要執行該命令,否則無法開啟相機
cd /opt/MVS/bin
./MVS.sh # 開啟軟體介面
安裝完,這些包就沒用了。把這些包刪除即可。
rm -r MVS_STD_V3.0.1_240422/
4. docker 安裝海康工業相機ROS環境
mkdir -p hik_camera_ws/src
把之前的 ROS 包 copy 為 hik_camera_ws
rm -r build devel
catkin_make
source devel/setup.bash
roslaunch mvs_ros_pkg mvs_camera_trigger.launch