osrf / docker_images

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

[Doubt] Why are the Dockerfiles for ros-base performing rosdep init and colcon mixins if they are installing it from repository? #739

Closed blacklightpy closed 6 months ago

blacklightpy commented 6 months ago

In this Dockerfile: https://github.com/osrf/docker_images/blob/master/ros/iron/ubuntu/jammy/ros-base/Dockerfile

By the end, it performs RUN apt-get update && apt-get install -y --no-install-recommends ros-iron-ros-base=0.10.0-3*. Then why did it have to do rosdep init and rosdep update like with a source install?

I was trying to figure out how ROS binaries are built, especially as different variants, and I can't seem to get a good picture.

The docs tell you about running vcs import, then rosdep init and then colcon build to build workspace overlays. Nothing about building a specific variant.

christophebedard commented 6 months ago

I was trying to figure out how ROS binaries are built, especially as different variants, and I can't seem to get a good picture.

The variants (-desktop, -ros-base, etc.) are just normal packages that depend on a list of specific packages: https://github.com/ros2/variants

Packages are built on the build farm: https://docs.ros.org/en/rolling/The-ROS2-Project/Contributing/Build-Farms.html

By the end, it performs RUN apt-get update && apt-get install -y --no-install-recommends ros-iron-ros-base=0.10.0-3*. Then why did it have to do rosdep init and rosdep update like with a source install?

Probably so that you can then use the image to build your own code on top of the ROS 2 binaries.

The docs tell you about running vcs import, then rosdep init and then colcon build to build workspace overlays. Nothing about building a specific variant.

If you're building ROS 2 + your package(s) from source, you don't really need to think about variants. You can just do colcon build --packages-up-to your_package to build your_package and all parts of ROS 2 that are needed (which is what the --packages-up-to option means). Explicitly building a variant (e.g., -desktop) might build packages that you don't really need.

blacklightpy commented 6 months ago

I think I've got a better understanding now after reading through the REPs and repos. Variants are just like the overlays. So --packages-up-to my_package was what I was missing in colcon build.

Also I see rosdep is used to stay on the latest index, while the binary package forms the underlay. My confusion was from thinking that rosdep update pulls in all the dependencies and mistaking colcon mixin to be the same as colcon build.

All clear!