microRTPS_bridge: structural change to make possible to generate pub/sub code for multi-topics/aliased msgs

This commit is contained in:
TSC21
2019-07-26 15:05:54 +02:00
committed by Beat Küng
parent a747116eab
commit 3d9f83a4f2
23 changed files with 290 additions and 153 deletions
+25 -11
View File
@@ -41,25 +41,37 @@ if(NOT FASTRTPSGEN)
endif()
if (EXISTS "${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_message_ids.yaml")
set(config_rtps_send_topics)
set(config_rtps_send_topics)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_classifier.py -s
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_classifier.py -sa
OUTPUT_VARIABLE config_rtps_send_topics
)
set(config_rtps_send_alias_topics "")
string(FIND ${config_rtps_send_topics} "alias" found_send_alias)
if (NOT ${found_send_alias} EQUAL "-1")
STRING(REGEX REPLACE ".*alias " "" config_rtps_send_alias_topics "${config_rtps_send_topics}")
STRING(REPLACE ", " ";" config_rtps_send_alias_topics "${config_rtps_send_alias_topics}")
STRING(REPLACE "\n" "" config_rtps_send_alias_topics "${config_rtps_send_alias_topics}")
STRING(REGEX REPLACE " alias.*" "" config_rtps_send_topics "${config_rtps_send_topics}")
endif()
STRING(REGEX REPLACE ", " ";" config_rtps_send_topics "${config_rtps_send_topics}")
STRING(REGEX REPLACE "\n" "" config_rtps_send_topics "${config_rtps_send_topics}")
set(config_rtps_receive_topics)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_classifier.py -r
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_classifier.py -ra
OUTPUT_VARIABLE config_rtps_receive_topics
)
STRING(REGEX REPLACE ", " ";" config_rtps_receive_topics "${config_rtps_receive_topics}")
STRING(REGEX REPLACE "\n" "" config_rtps_receive_topics "${config_rtps_receive_topics}")
set(config_rtps_receive_alias_topics "")
string(FIND ${config_rtps_receive_topics} "alias" found_receive_alias)
if (NOT ${found_receive_alias} EQUAL "-1")
STRING(REGEX REPLACE ".*alias " "" config_rtps_receive_alias_topics "${config_rtps_receive_topics}")
STRING(REPLACE ", " ";" config_rtps_receive_alias_topics "${config_rtps_receive_alias_topics}")
STRING(REPLACE "\n" "" config_rtps_receive_alias_topics "${config_rtps_receive_alias_topics}")
STRING(REGEX REPLACE " alias.*" "" config_rtps_receive_topics "${config_rtps_receive_topics}")
endif()
STRING(REPLACE ", " ";" config_rtps_receive_topics "${config_rtps_receive_topics}")
STRING(REPLACE "\n" "" config_rtps_receive_topics "${config_rtps_receive_topics}")
endif()
if (FASTRTPSGEN AND (config_rtps_send_topics OR config_rtps_receive_topics))
@@ -87,7 +99,8 @@ if (GENERATE_RTPS_BRIDGE)
set(uorb_sources_microcdr)
# send topic files
message(STATUS "RTPS send: ${config_rtps_send_topics}")
STRING(REGEX REPLACE ";" ", " send_list "${config_rtps_send_topics};${config_rtps_send_alias_topics}")
message(STATUS "RTPS send: ${send_list}")
set(send_topic_files)
foreach(topic ${config_rtps_send_topics})
list(APPEND send_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
@@ -96,7 +109,8 @@ if (GENERATE_RTPS_BRIDGE)
endforeach()
# receive topic files
message(STATUS "RTPS receive: ${config_rtps_receive_topics}")
STRING(REGEX REPLACE ";" ", " rcv_list "${config_rtps_receive_topics};${config_rtps_receive_alias_topics}")
message(STATUS "RTPS receive: ${rcv_list}")
set(receive_topic_files)
foreach(topic ${config_rtps_receive_topics})
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
@@ -45,6 +45,14 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
endforeach()
if (NOT "${config_rtps_send_alias_topics}" STREQUAL "")
set(config_rtps_send_topics "${config_rtps_send_topics};${config_rtps_send_alias_topics}")
endif()
if (NOT "${config_rtps_receive_alias_topics}" STREQUAL "")
set(config_rtps_receive_topics "${config_rtps_receive_topics};${config_rtps_receive_alias_topics}")
endif()
foreach(topic ${config_rtps_send_topics})
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Publisher.cpp)
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Publisher.h)
@@ -55,16 +63,6 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Subscriber.h)
endforeach()
set(send_topic_files_opt)
if (NOT "${send_topic_files}" STREQUAL "")
set(send_topic_opt "--send")
endif()
set(receive_topic_files_opt)
if (NOT "${receive_topic_files}" STREQUAL "")
set(receive_topic_opt "--receive")
endif()
list(APPEND topic_bridge_files_out
${msg_out_path}/micrortps_client/microRTPS_client.cpp
${msg_out_path}/micrortps_client/microRTPS_transport.cpp