The meta-ros layer delivers support for ROS. Additionally, meta-ost-ros provides ost-ros-image
to build an image adding ROS Core to ost-image
.
Building Images
ROS requires the meta-ost-ros
layer that is part of meta-ost.
Follow the Setup and Building guide to set up the build environment. Fetch ROS specific repositories:
meta-ros, github.com/ros/meta-ros.git, branch kirkstone
Checkout commit hash 01ba3e424e111125fb411886cb823138607d5ebb
Next, add the following layers to bblayers.conf
BBLAYERS ?= " \
...
/home/ubuntu/yocto/meta-openembedded/meta-python \
/home/ubuntu/yocto/meta-ost/meta-ost-ros \
/home/ubuntu/yocto/meta-ros/meta-ros-common \
/home/ubuntu/yocto/meta-ros/meta-ros2 \
/home/ubuntu/yocto/meta-ros/meta-ros2-humble \
"
Now, build the image with
$ bitbake ost-ros-image
Restrictions for ROS
A Note about rosdep
rosdep
manages ROS dependencies by mapping ROS packages names to the name of their corresponding native package name (e.g. apt packages for ubuntu). This means that while cross compiling ROS2 nodes is fairly straight forward , its dependencies won't be, and ROS(2) must still be present on the host system.
Even compiling ROS2 from source seems to rely on this mechanism to some extent, meaning that even cross compiling all of ROS2 to work within a yocto image is not feasible, or at least not trivial.