目前要想运行arm版ros humble 目前最好的解决方案是使用qemu模拟。
1.拉取 ubuntu22.04
docker pull ubuntu:22.04 --platform=arm64
2.安装小鱼ros2 humble
wget http://fishros.com/install -O fishros && . fishros
3.安装eqmu
docker run --rm --privileged multiarch/qemu-user-static:register
4.运行arm版humble
docker run --rm -it -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static {$镜像id$} /bin/bash -c "uname -m; exec /bin/bash"
5.使用docker-compose来运行
此处有两个生成方案
第一个是x86的,第二个是arm版本的,当我们使用vscode 进行远程开发的时候我们需要把相应的.vscode-server分别对应出来比如西面的docker-compose所示, 其中image: dd5d 是使用ubuntu22.04 并安装了humble的版本image。
version: '3.8'
services:robot-humble:build: .privileged: truedevices:- /dev/ttyUSB0environment:- DISPLAY=host.docker.internal:0.0volumes:- ./modules:/usr/lib/modules- ./.vscode-server:/root/.vscode-server- ./ros2_ws:/root/ros2_wsports:- 9090:9090tty: truecommand: /bin/bashrobot-humble-arm:image: dd5dprivileged: truedevices:- "/dev/ttyUSB0:/dev/ttyUSB0"environment:- DISPLAY=host.docker.internal:0.0volumes:- /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static- ./modules:/usr/lib/modules- ./.vscode-server-arm:/root/.vscode-server- ./ros2_ws:/root/ros2_wsports:- "9090:9090"tty: truecommand: ["/bin/bash", "-c", "uname -m; exec /bin/bash"]
Dockerfile内容为(这里是x86的)
FROM osrf/ros:humble-desktop-full-jammy
PS 下载.vscode-server
https://blog.csdn.net/qq_43623902/article/details/136258880
x86:
https://vscode.download.prss.microsoft.com/dbazure/download/stable/${commit_id}/vscode-server-linux-x64.tar.gzarm:
https://vscode.download.prss.microsoft.com/dbazure/download/stable/${commit_id}/vscode-server-linux-arm64.tar.gz
并解压文件夹
/root/.vscode-server/bin/2fc07b811f760549dab9be9d2bedd06c51dfcb9a/下,内容大致为
LICENSE bin extensions node node_modules out package.json product.json