osrf / docker_images

A repository to hold definitions of docker images maintained by OSRF
Apache License 2.0
578 stars 172 forks source link

ros2 for arm32/v7 (raspi 3) #722

Closed elgarbe closed 9 months ago

elgarbe commented 9 months ago

Is there a foxy/humble/iron image for raspberry pi 3? I can't find any on https://hub.docker.com/r/arm32v7/ros/tags

Thank

sloretz commented 9 months ago

There is not. All of the supported ROS 2 distros have arm32/v7 support listed as Tier 3 from source only in REP 2000. That means you'll have to build ROS 2 from source for that architecture.

Instructions for building ROS 2 from source are here: https://docs.ros.org/en/rolling/Installation/Alternatives/Ubuntu-Development-Setup.html

elgarbe commented 9 months ago

Thank! Reading a little more I've noticed that raspi 3 is 64bit arm v8 so I've installed Ubuntu server 22.04 and then ros2 iron. I will use docker anyway, but now I have an aarch64 os and everything is easy.

elgarbe commented 9 months ago

Now I'm working on an odroid xu4 that actually is an ARMv7. I've installed an official Ubuntu 22.04 but I can't install ros2 from binary package So I need to build from source. I would like to use docker anyway, do I need to use "source" Dockerfile? Can I build humble this way?

mikaelarguedas commented 9 months ago

Duplicate of https://github.com/osrf/docker_images/issues/573#issuecomment-960456619, https://github.com/osrf/docker_images/issues/575, https://github.com/osrf/docker_images/issues/556

mikaelarguedas commented 9 months ago

I would like to use docker anyway, do I need to use "source" Dockerfile? Can I build humble this way?

Yes you can.

For example for building an Humble image from source

cd docker_images/ros2/source/
docker build --tag=osrf/ros2:devel devel/.
docker build --tag=osrf/ros2:source  source/. --build-arg="ROS_DISTRO=humble"

Note that the source image will clone and build all repos listed in the ros2.repos file for the ROS version you picked; aka a LOT of stuff including e.g. rviz. You might want to adjust the set of repos and packages to build to match your setup to reduce your build time and resulting image size to be tailored to your needs

You can use rosinstall_generator for that, you'll find a couple resources online (e.g. https://github.com/ros2/ros2_documentation/issues/870#issuecomment-683938376)

elgarbe commented 9 months ago

Thank for your help! Right now I'm cross building a ros2:humble image (ros2_core from rosinstall_generator) thanks to docker buildx. But I have one last question. Can I remove

  python3-pip \
  python3-pytest-cov \
  python3-flake8-blind-except \
  python3-flake8-class-newline \
  python3-flake8-deprecated \
  python3-pytest-repeat \
  python3-pytest-rerunfailures \
  ros-dev-tools

after colcon build? I would like to have a small image and use it as a base for other images where I will build other specific ros2 packages, like mavros, micro-ros. May I remove some other packages used by colcon build but not for ros2 packages?

mikaelarguedas commented 9 months ago

Can I remove blabla after colcon build?

yes

It's up to you what dev tools you want or not in your images.

I would like to have a small image and use it as a base for other images where I will build other specific ros2 packages

You will likely need build tools and dev tools to be able to build these following images

The topic of overall build dependencies vs runtime dependencies is discussed in a couple places. e.g. https://discourse.ros.org/t/package-separation-for-building-and-running-ros-applications/35527