1.ubuntu22.04安装Docker

sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

验证Docker

启动 Docker 服务:在终端中执行以下命令来立即启动 Docker 守护进程。

bash

sudo systemctl start docker
sudo docker run hello-world

Docker 官方文档也建议用 hello-world 验证安装是否成功。

2. 拉取ros1-noetic镜像

docker pull osrf/ros:noetic-desktop-full

Ubuntu 主机先允许 Docker 访问 X11:

sudo apt install -y x11-xserver-utils
xhost +local:docker

运行GUI容器

mkdir -p ~/ros1_ws/src

docker run -it \
  --name ros1_noetic_gui \
  --net=host \
  --ipc=host \
  -e DISPLAY=$DISPLAY \
  -e QT_X11_NO_MITSHM=1 \
  -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
  -v ~/ros1_ws:/root/ros1_ws \
  osrf/ros:noetic-desktop-full \
  bash

以后你主机上的代码放在:

~/ros1_ws/src

容器内对应路径就是:

/root/ros1_ws/src

这样即使容器删了,代码也还在主机上。

3. Github某项目,关于全局路径规划

项目地址:https://github.com/ai-winter/ros_motion_planning.git

4. 运行效果

更多推荐