feat(zenoh): bridge the topics of out-of-tree messages

Out-of-tree messages could be bridged by the uXRCE-DDS client but not by
Zenoh: they were missing from the Kconfig topic catalog, so the factory
compiled their types out, and their topics from the default configuration.

Zenoh now reads $EXTERNAL_MODULES_LOCATION/msg/dds_topics.yaml after its own
topics file, like the uXRCE-DDS client, and the catalog includes the
out-of-tree messages. EXTERNAL_MODULES_LOCATION is resolved before Kconfig
so the catalog sees it as an absolute path.

Assisted-by: Claude-Code:claude-opus-5-5
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>
This commit is contained in:
Beniamino Pozzan committed 2026-11-22 09:07:09 +00:00
1 parent 288b114841
commit 18a25db5bb
3 files changed
+24 -9

No files matched your search

+7 -7
View File
@@ -217,6 +217,13 @@ if(PYTHON_COVERAGE)
set(PYTHON_EXECUTABLE coverage run -p)
endif()
# external modules (before kconfig, which adds their messages to the Zenoh topic catalog)
set(EXTERNAL_MODULES_LOCATION "" CACHE STRING "External modules source location")
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
get_filename_component(EXTERNAL_MODULES_LOCATION "${EXTERNAL_MODULES_LOCATION}" ABSOLUTE)
endif()
include(px4_config)
include(kconfig)
message(STATUS "PX4 config: ${PX4_CONFIG}")
@@ -238,13 +245,6 @@ if(${PX4_PLATFORM} STREQUAL "posix")
endif()
endif()
# external modules
set(EXTERNAL_MODULES_LOCATION "" CACHE STRING "External modules source location")
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
get_filename_component(EXTERNAL_MODULES_LOCATION "${EXTERNAL_MODULES_LOCATION}" ABSOLUTE)
endif()
set_property(GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
include(platforms/${PX4_PLATFORM}/cmake/px4_impl_os.cmake)
+5
View File
@@ -41,6 +41,11 @@ file(GLOB zenoh_catalog_msg_files
${PX4_SOURCE_DIR}/msg/*.msg
${PX4_SOURCE_DIR}/msg/versioned/*.msg
)
# Out-of-tree messages, so that Zenoh can bridge them too
if(EXTERNAL_MODULES_LOCATION)
file(GLOB zenoh_catalog_external_msg_files ${EXTERNAL_MODULES_LOCATION}/msg/*.msg)
list(APPEND zenoh_catalog_msg_files ${zenoh_catalog_external_msg_files})
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/zenoh/px_generate_zenoh_topic_files.py
--zenoh-config
+12 -2
View File
@@ -90,14 +90,24 @@ if(CONFIG_ZENOH_SERIAL)
target_compile_options(zenohpico_static PRIVATE -DZ_LINK_SERIAL)
endif()
# PX4's topics, then those of out-of-tree messages listed in $EXTERNAL_MODULES_LOCATION/msg/dds_topics.yaml
set(dds_topics_files ${CMAKE_CURRENT_SOURCE_DIR}/dds_topics.yaml)
if(EXTERNAL_MODULES_LOCATION AND EXISTS ${EXTERNAL_MODULES_LOCATION}/msg/dds_topics.yaml)
list(APPEND dds_topics_files ${EXTERNAL_MODULES_LOCATION}/msg/dds_topics.yaml)
endif()
set(dds_topics_args)
foreach(dds_topics_file ${dds_topics_files})
list(APPEND dds_topics_args --dds-topics-file ${dds_topics_file})
endforeach()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/default_topics.c
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../uxrce_dds_client/generate_dds_topics.py
--client-outdir ${CMAKE_CURRENT_BINARY_DIR}
--dds-topics-file ${CMAKE_CURRENT_SOURCE_DIR}/dds_topics.yaml
${dds_topics_args}
--template_file ${CMAKE_CURRENT_SOURCE_DIR}/default_topics.c.em
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/../uxrce_dds_client/generate_dds_topics.py
${CMAKE_CURRENT_SOURCE_DIR}/dds_topics.yaml
${dds_topics_files}
${CMAKE_CURRENT_SOURCE_DIR}/default_topics.c.em
COMMENT "Generating Default config"
)