Windows Docker运行GitHub - ZJU-FAST-Lab/Implicit-SVSDF-Planner: [SIGGRAPH 2024 & TOG]
1. 设置环境
我将项目git clone在D:/Github目录中。
下载ubuntu20.04 noetic镜像
docker pull osrf/ros:noetic-desktop-full-focal
启动容器,挂载主机的D:/Github文件夹为/home,并将容器初始进入的路径设为/home。
docker run -dit -v D:/Github:/home -w /home --name noetic osrf/ros:noetic-desktop-full-focal
进入容器并编译项目:
docker exec -it noetic bash
source /opt/ros/noetic/setup.bash
cd Implicit-SVSDF-Planner/
./build.sh
报错1:
root@18267cd27b32:/home/Implicit-SVSDF-Planner# ./build.sh bash: ./build.sh: /bin/bash^M: bad interpreter: No such file or directory
将win字符转译为unix
sed -i 's/\r$//' build.sh
报错2:
Compilation failed due to link of gfortran. You should refer to https://askubuntu.com/questions/276892/cannot-find-lgfortran or use ubuntu20 instead
安装包解决:
sudo apt update
sudo apt install gfortran
编译结束
2. 运行
source /opt/ros/noetic/setup.bash
cd Implicit-SVSDF-Planner/
source devel/setup.bash
export DISPLAY=host.docker.internal:0
roslaunch plan_manager run_sdTunnel.launch
使用VcXsrv可视化时出现了rviz的报错,参考以下使用MobaXterm完成运行。
win10 下 wsl2 使用 rviz 报错 Segmentation fault 段错误 (核心已转储) 的另一可能解决方案_rviz启动报错segmentation fault-CSDN博客
测试gpu但发现没有区别的运行代码:
docker run -dit -v D:/Github:/home -w /home --gpus all -e DISPLAY=host.docker.internal:0.0 -v /tmp/.X11-unix:/tmp/.X11-unix --network=host --privileged -it --name testrviz ros:noetic bash
3. 保存镜像
docker commit noetic my_new_image:latest