Build ROS2 package that contains custom interfaces (msg, srv) #yocto


bojankoce
 

Hi, guys!

I have a DART-MX8M-Mini machine running Yocto Hardknott.

I properly added meta-ros layer and ROS2 foxy distro to our Yocto build by following instructions from here (Sanity Tests pass successfully).

With the help of devtool, I was able to build my custom ROS2 package (containing simple talker and listener nodes - link). For that to happen, I got some great support from the Yocto community - link.

Here is the content of my-first-yocto-pkg_git.bb recipe that enabled me to download my source code from the git and properly build the ROS2 package:

# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!

DESCRIPTION = "Examples of minimal publisher/subscriber using rclcpp."
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://package.xml;beginline=8;endline=8;md5=12c26a18c7f493fdc7e8a93b16b7c04f"

SRC_URI = "git://github.com/bojankoce/my_first_yocto_pkg;protocol=https"

# Modify these as desired
PV = "0.1.0"
SRCREV = "1312445de2e6861d9561c0f89f4827b94c2ff6b1"

S = "${WORKDIR}/git"

# NOTE: unable to map the following CMake package dependencies: rclcpp ament_lint_auto std_msgs ros_ament_cmake
inherit ros_distro_foxy
inherit ros_superflore_generated
inherit ros_ament_cmake

ROS_BUILD_DEPENDS = " \
    rclcpp \
    std-msgs \
"

ROS_BUILDTOOL_DEPENDS = " \
	ament-cmake-native \
"

ROS_EXPORT_DEPENDS = ""

ROS_BUILDTOOL_EXPORT_DEPENDS = ""

ROS_EXEC_DEPENDS = " \
    launch-ros \
    std-msgs \
"

DEPENDS = "${ROS_BUILD_DEPENDS} ${ROS_BUILDTOOL_DEPENDS}"

DEPENDS += "${ROS_EXPORT_DEPENDS} ${ROS_BUILDTOOL_EXPORT_DEPENDS}"

# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
#EXTRA_OECMAKE = ""

I currently have a hard time building my ROS2 package that contains only custom ROS2 interfaces (messages and services).
CMakeLists.txt file of that package contains the following lines that are causing the build errors:

find_package(rosidl_default_generators REQUIRED)
...

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/MessageX.msg"
  "msg/MessageY.msg"
  "srv/SrvX.srv"
  "srv/SrvY.srv"
 )

Do you have any idea about what should be included as inherit xxxxx or within ROS_BUILD_DEPENDS/ROS_BUILDTOOL_DEPENDS /ROS_EXEC_DEPENDS ... in order to successfully generate the ROS2 package containing custom interfaces?

Thanks in advance for your time and efforts. It is appreciated.

Sincerely,
Bojan.

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.