From 08e57bfb7825aeda125a1e24cf5f22017d023e2a Mon Sep 17 00:00:00 2001 From: MMarcus95 Date: Wed, 1 Jul 2026 15:07:38 +0200 Subject: [PATCH 1/5] moving compilation inside msg submodule - wip --- modules/messages/CMakeLists.txt | 58 ---- modules/messages/README.md | 13 - .../messages/cmake/generate_msg_library.cmake | 251 ------------------ 3 files changed, 322 deletions(-) delete mode 100644 modules/messages/CMakeLists.txt delete mode 100644 modules/messages/README.md delete mode 100644 modules/messages/cmake/generate_msg_library.cmake diff --git a/modules/messages/CMakeLists.txt b/modules/messages/CMakeLists.txt deleted file mode 100644 index fee4eeee..00000000 --- a/modules/messages/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -cmake_policy(SET CMP0048 NEW) - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -add_compile_options("-std=c++2a") - - -# ================================== Messages ================================= -# create a dls_message library. Then link to this library all the libraries generated by idls_messages. This way we can link to dls_message and get all the messages. -include(generate_msg_library) -set (LIBRARY_NAME dls_messages) - -add_library(${LIBRARY_NAME} SHARED) - -# iterate over all the idl files that are in the idls directory. Extract the name of the idl and the subdirectory where the idl is located. -file(GLOB_RECURSE idl_files CONFIGURE_DEPENDS - "${CMAKE_CURRENT_SOURCE_DIR}/idls/*.idl" -) - -# generate msg files using fastddsgen -foreach(idl_file IN LISTS idl_files) - fastddsgen_trigger(${idl_file}) -endforeach() - -# Create a custom target that depends on all the fastddsgen targets, so that we can wait for all the generated files to be created before building the cpp and python libraries. -add_custom_target(dls_messages_fastddsgen_all - DEPENDS ${DLS_MESSAGES_FASTDDSGEN_TARGETS} -) -add_dependencies(${LIBRARY_NAME} - dls_messages_fastddsgen_all -) - -# add cpp generated files to the LIBRARY_NAME library and create python bindings for the generated cpp files -foreach(idl_file IN LISTS idl_files) - generate_msg_library(${idl_file} ${LIBRARY_NAME}) - get_property(CPP_LIBRARY_NAME GLOBAL PROPERTY CPP_LIBRARY_NAME) -endforeach() - -target_include_directories(${LIBRARY_NAME} - PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/include -) -target_link_libraries(${LIBRARY_NAME} - PUBLIC - fastcdr - fastdds -) - -dls_install(${LIBRARY_NAME}) - -install( - DIRECTORY - ${CMAKE_CURRENT_LIST_DIR}/cmake/ - DESTINATION - /usr/include/${LIBRARY_NAME}/cmake - COMPONENT - dls_dev -) \ No newline at end of file diff --git a/modules/messages/README.md b/modules/messages/README.md deleted file mode 100644 index 56f6b387..00000000 --- a/modules/messages/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Messages -This package defines and build off-the-shelf messages for DLS2 and their related wrappers. It also provides you the cmake function that can be used by the user to generate custom messages and wrappers. - -# Message generation -Each message is defined by an idl file inside the [idls](idls) folder. See [here](https://fast-dds.docs.eprosima.com/en/latest/fastddsgen/dataTypes/dataTypes.html) for details about how to define a message in IDL format. - -To generate messages for fastdds, the [fastddgen](https://fast-dds.docs.eprosima.com/en/latest/fastddsgen/introduction/introduction.html) tool is used (check the cmake function _dls_add_message_ inside [dls_message.cmake](cmake/dls_message.cmake) file). - -# Wrapper concept and generation -A message wrapper is a C++ class that wraps the types defined in the idl file to C++ types. It is used in DLS2 to customize the C++ data types - - -To have DLS2 independent from the middleware that is providing the messages (e.g. fastdds, cyclonedds, etc.), DLS2 defines wrappers around idls files that allows the user to customize, to certain extend, the data type to be used for each field of the idl. \ No newline at end of file diff --git a/modules/messages/cmake/generate_msg_library.cmake b/modules/messages/cmake/generate_msg_library.cmake deleted file mode 100644 index f74d72b4..00000000 --- a/modules/messages/cmake/generate_msg_library.cmake +++ /dev/null @@ -1,251 +0,0 @@ -################################################################################ -# INITIALIZATION FOR PYTHON BINDINGS -# find swig for python bindings -find_package(SWIG) -if (NOT SWIG_FOUND) - # Trick to find swig4.1 in Ubuntu noble. - find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) - find_package(SWIG REQUIRED) -endif() -include(${SWIG_USE_FILE}) -set(CMAKE_SWIG_FLAGS "") - -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -################################################################################ - -################################################################################# -function(set_msg_build_names idl_file_name subdirectory) - # set message directory for generated files - set(MESSAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include/dls_messages/dds${subdirectory}") - - # define files produced by fastddsgen - set(generated_cpp_source - "${MESSAGE_DIR}/${idl_file_name}PubSubTypes.cxx" - "${MESSAGE_DIR}/${idl_file_name}TypeObjectSupport.cxx" - ) - set(generated_cpp_headers - "${MESSAGE_DIR}/${idl_file_name}.hpp" - "${MESSAGE_DIR}/${idl_file_name}PubSubTypes.hpp" - "${MESSAGE_DIR}/${idl_file_name}TypeObjectSupport.hpp" - "${MESSAGE_DIR}/${idl_file_name}CdrAux.hpp" - "${MESSAGE_DIR}/${idl_file_name}CdrAux.ipp" - ) - set(generated_py_source - "${MESSAGE_DIR}/${idl_file_name}.i" - "${MESSAGE_DIR}/${idl_file_name}PubSubTypes.i" - ) - # set library name for the generated cpp files - string(REPLACE "/" "_" subdirectory_name "${subdirectory}") - string(REGEX REPLACE "^_" "" subdirectory_name "${subdirectory_name}") - set(subdirectory_name ${subdirectory_name}) - - set(CPP_LIBRARY_NAME "${subdirectory_name}_${idl_file_name}_msg_cpp") - - # set global properties for the generated files and library name - set_property(GLOBAL PROPERTY MESSAGE_DIR "${MESSAGE_DIR}") - set_property(GLOBAL PROPERTY generated_cpp_source "${generated_cpp_source}") - set_property(GLOBAL PROPERTY generated_cpp_headers "${generated_cpp_headers}") - set_property(GLOBAL PROPERTY generated_py_source "${generated_py_source}") - set_property(GLOBAL PROPERTY subdirectory_name "${subdirectory_name}") - set_property(GLOBAL PROPERTY CPP_LIBRARY_NAME "${CPP_LIBRARY_NAME}") - -endfunction() -################################################################################# - -################################################################################# -function(extract_file_and_subdirectory_names idl_file) - get_filename_component(idl_file_name "${idl_file}" NAME_WE) - get_filename_component(idl_directory "${idl_file}" DIRECTORY) - - file(RELATIVE_PATH subdirectory - "${CMAKE_CURRENT_SOURCE_DIR}/idls" - "${idl_directory}" - ) - if(subdirectory STREQUAL ".") - set(subdirectory "") - else() - set(subdirectory "/${subdirectory}") - endif() - # set global properties for the extracted names - set_property(GLOBAL PROPERTY idl_file_name "${idl_file_name}") - set_property(GLOBAL PROPERTY subdirectory "${subdirectory}") -endfunction() -################################################################################# - -function(fastddsgen_trigger idl_file_path) - extract_file_and_subdirectory_names(${idl_file_path}) - - get_property(idl_file_name GLOBAL PROPERTY idl_file_name) - get_property(subdirectory GLOBAL PROPERTY subdirectory) - set_msg_build_names("${idl_file_name}" "${subdirectory}") - - ############################################################ - # RUN FASTDDSGEN TO GENERATE CPP AND PYTHON FILES - get_property(MESSAGE_DIR GLOBAL PROPERTY MESSAGE_DIR) - set(fastddsgen_command - fastddsgen - -typeros2 - -replace - -cs - -python - -d - ${MESSAGE_DIR} - -I ${CMAKE_CURRENT_SOURCE_DIR}/idls - -I ${CMAKE_CURRENT_SOURCE_DIR}/idls/ros2_interface - ${idl_file_path} - ) - - get_property(generated_cpp_source GLOBAL PROPERTY generated_cpp_source) - get_property(generated_cpp_headers GLOBAL PROPERTY generated_cpp_headers) - get_property(generated_py_source GLOBAL PROPERTY generated_py_source) - add_custom_command( - OUTPUT "${MESSAGE_DIR}/${idl_file_name}.stamp" - BYPRODUCTS - ${generated_cpp_source} - ${generated_cpp_headers} - ${generated_py_source} - COMMAND - ${CMAKE_COMMAND} -E make_directory ${MESSAGE_DIR} - COMMAND - ${fastddsgen_command} - COMMAND - ${CMAKE_COMMAND} -E touch "${MESSAGE_DIR}/${idl_file_name}.stamp" - COMMENT - "Generating message files for ${idl_file_name}.idl" - DEPENDS - ${idl_file_path} - ) - # ############################################################ - - # ############################################################ - # Create a custom target to ensure that the generated files are created before building the cpp/python libraries - get_property(CPP_LIBRARY_NAME GLOBAL PROPERTY CPP_LIBRARY_NAME) - add_custom_target(${CPP_LIBRARY_NAME}_target ALL - DEPENDS - "${MESSAGE_DIR}/${idl_file_name}.stamp" - ) - # Chaining ${CPP_LIBRARY_NAME}_target generator targets sequentially, so fastddsgen -replace cannot run concurrently for different IDLs. - get_property(previous_fastddsgen_target GLOBAL PROPERTY DLS_MESSAGES_PREVIOUS_FASTDDSGEN_TARGET) - if(previous_fastddsgen_target) - add_dependencies(${CPP_LIBRARY_NAME}_target ${previous_fastddsgen_target}) - endif() - set_property(GLOBAL PROPERTY DLS_MESSAGES_PREVIOUS_FASTDDSGEN_TARGET ${CPP_LIBRARY_NAME}_target) - # Define a variable to hold all the fastddsgen targets, to wait their compilation before cpp and python libraries are built. - set(DLS_MESSAGES_FASTDDSGEN_TARGETS - ${DLS_MESSAGES_FASTDDSGEN_TARGETS} - ${CPP_LIBRARY_NAME}_target - PARENT_SCOPE - ) - -endfunction() - -function(generate_msg_library idl_file_path library_name) - extract_file_and_subdirectory_names(${idl_file_path}) - - get_property(idl_file_name GLOBAL PROPERTY idl_file_name) - get_property(subdirectory GLOBAL PROPERTY subdirectory) - set_msg_build_names("${idl_file_name}" "${subdirectory}") - - # ############################################################ - # add CPP source files to the library and include directories for the library - get_property(CPP_LIBRARY_NAME GLOBAL PROPERTY CPP_LIBRARY_NAME) - get_property(generated_cpp_source GLOBAL PROPERTY generated_cpp_source) - get_property(generated_cpp_headers GLOBAL PROPERTY generated_cpp_headers) - - target_sources(${library_name} - PRIVATE - ${generated_cpp_source} - ) - # add dependency to ensure that the generated files are created before building the cpp library - - get_property(MESSAGE_DIR GLOBAL PROPERTY MESSAGE_DIR) - target_include_directories(${library_name} - PUBLIC - ${MESSAGE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/include/dls_messages/dds/ros2_interface - ) - # ############################################################ - - # ############################################################ - # add PYTHON bindings for the generated source files - # from FAST-DDS-python example - get_property(subdirectory_name GLOBAL PROPERTY subdirectory_name) - # if subdiredtory_name is empty, set ${idl_file_name}Wrapper instaead of _${subdirectory_name}_${idl_file_name}Wrapper - if(subdirectory_name STREQUAL "") - set(${idl_file_name}_MODULE "${idl_file_name}Wrapper") - else() - set(${idl_file_name}_MODULE "${subdirectory_name}_${idl_file_name}Wrapper") - endif() - - set(${idl_file_name}_MODULE_FILES - ${MESSAGE_DIR}/${idl_file_name}.i - ) - # -w302: Warning 302: Identifier 'double_vector' redefined (ignored) (Renamed from 'vector< double >'), - # -w389: Warning 389: /usr/local/include/fastdds/dds/core/LoanableTypedCollection.hpp:68: Warning 389: operator[] ignored (consider using %extend) - # -w509: Warning 509: Warning 509: Overloaded method dls2_interface::msg::ArmState::ArmState(dls2_interface::msg::ArmState &&) effectively ignored, - SET_SOURCE_FILES_PROPERTIES( - ${${idl_file_name}_MODULE_FILES} - PROPERTIES CPLUSPLUS ON OUTPUT_DIR "${MESSAGE_DIR}" SWIG_FLAGS "-w302,389,509" - USE_TARGET_INCLUDE_DIRECTORIES TRUE - ) - - SWIG_ADD_LIBRARY(${${idl_file_name}_MODULE} - TYPE SHARED - LANGUAGE python - SOURCES ${${idl_file_name}_MODULE_FILES}) - - # add dependency to ensure that the generated files are created before building the python library - add_dependencies(${${idl_file_name}_MODULE} - dls_messages_fastddsgen_all - ) - # ${${idl_file_name}_MODULE}_swig_compilation target can be created automatically by CMake - if(TARGET ${${idl_file_name}_MODULE}_swig_compilation) - add_dependencies(${${idl_file_name}_MODULE}_swig_compilation - dls_messages_fastddsgen_all - ) - endif() - - set_property(TARGET ${${idl_file_name}_MODULE} PROPERTY CXX_STANDARD 11) - if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8) - set_property(TARGET ${${idl_file_name}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64) - endif() - target_include_directories(${${idl_file_name}_MODULE} - PRIVATE - /usr/local/include - ) - - target_link_libraries(${${idl_file_name}_MODULE} - Python3::Module - fastdds - ${library_name} - ) - # -Wno-missing-field-initializers: warning: missing initializer for member '_typeobject::tp_watched' - # -Wno-unused-parameter: warning: unused parameter 'self' [-Wunused-parameter] 5496 | SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *self, PyObject *args) - # -Wno-delete-non-virtual-dtor: warning: deleting object of abstract class type 'eprosima::fastdds::dds::LoanableTypedCollection >' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor] 10017 | delete arg1; - target_compile_options(${${idl_file_name}_MODULE} PRIVATE - -Wno-missing-field-initializers - -Wno-unused-parameter - -Wno-delete-non-virtual-dtor - ) - ############################################################ - - ############################################################ - # Install python bindings - # Find the installation path - execute_process( - COMMAND - ${Python3_EXECUTABLE} -c "import sysconfig; schemes = sysconfig.get_scheme_names(); scheme = 'deb_system' if 'deb_system' in schemes else sysconfig.get_default_scheme(); print(sysconfig.get_path('purelib', scheme=scheme))" - OUTPUT_VARIABLE - _ABS_PYTHON_MODULE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - get_filename_component(_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE) - file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH}) - SET (PYTHON_MODULE_PATH - ${_REL_PYTHON_MODULE_PATH}/${PROJECT_NAME} - ) - install(TARGETS ${${idl_file_name}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}) - get_property(support_files TARGET ${${idl_file_name}_MODULE} PROPERTY SWIG_SUPPORT_FILES) - install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}) -endfunction() \ No newline at end of file From 9ed4100542d0e159d3fe8b146d37af2f805ee173 Mon Sep 17 00:00:00 2001 From: MMarcus95 Date: Wed, 1 Jul 2026 15:07:56 +0200 Subject: [PATCH 2/5] update submodule dls2_msgs --- modules/messages/idls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/messages/idls b/modules/messages/idls index e72ebe20..4a3a7ef2 160000 --- a/modules/messages/idls +++ b/modules/messages/idls @@ -1 +1 @@ -Subproject commit e72ebe202e3fa6c38fe9e1dd3cdd91118ca0a988 +Subproject commit 4a3a7ef2e2a9a8edf6427ffdef30c4aac2ae641f From 5dff3a6c2de1e055768b3399ccc3fadc5450a822 Mon Sep 17 00:00:00 2001 From: MMarcus95 Date: Wed, 1 Jul 2026 15:09:38 +0200 Subject: [PATCH 3/5] removed dls2_msgs submodule --- .gitmodules | 3 --- modules/messages/idls | 1 - 2 files changed, 4 deletions(-) delete mode 160000 modules/messages/idls diff --git a/.gitmodules b/.gitmodules index 3ce8800d..5373c29d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "modules/log/third-party/magic_enum"] path = modules/log/third-party/magic_enum url = git@github.com:Neargye/magic_enum.git -[submodule "modules/messages/idls"] - path = modules/messages/idls - url = git@github.com:iit-DLSLab/dls_std_msgs.git diff --git a/modules/messages/idls b/modules/messages/idls deleted file mode 160000 index 4a3a7ef2..00000000 --- a/modules/messages/idls +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4a3a7ef2e2a9a8edf6427ffdef30c4aac2ae641f From 15a66e76a3229fb7dfe9dfe61dbe566dfae34ccb Mon Sep 17 00:00:00 2001 From: MMarcus95 Date: Wed, 1 Jul 2026 15:33:57 +0200 Subject: [PATCH 4/5] removed old messages folder --- modules/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 628b5dda..503750a4 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -11,7 +11,6 @@ add_subdirectory(topics) add_subdirectory(ddscom) add_subdirectory(domains) add_subdirectory(signal) -add_subdirectory(messages) add_subdirectory(application) add_subdirectory(motion_generator) add_subdirectory(parameter_server) From f13215f8dc9269707918784f9effdb40beac2361 Mon Sep 17 00:00:00 2001 From: MMarcus95 Date: Wed, 1 Jul 2026 15:34:07 +0200 Subject: [PATCH 5/5] cleanup default startup --- modules/main/src/default_startup.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/main/src/default_startup.yaml b/modules/main/src/default_startup.yaml index 867b7e57..647bd54d 100644 --- a/modules/main/src/default_startup.yaml +++ b/modules/main/src/default_startup.yaml @@ -1,18 +1,18 @@ # layers -layers: [hardware, control, estimation, log] +layers: [hardware, estimation, log] # applications -hardwares: [gazebo_sim] -controllers: [pid, trunk_controller] -motion_generators: [periodic_generator, keyboard] +hardwares: [] +controllers: [] +motion_generators: [] estimators: [] python_periodic_apps: [] generic_app_plugins: [] generic_periodic_app_plugins: [] # robot name -robot_name: "aliengo" +robot_name: "" robot_spawning_height: 0.366 # applications to be activated -activate: [gazebo_sim, pid, trunk_controller] \ No newline at end of file +activate: [] \ No newline at end of file