mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 03:50:34 +08:00
parse output from python script into readable cmake list to use; refactor RTPS scripts
This commit is contained in:
@@ -40,20 +40,27 @@ if(NOT FASTRTPSGEN)
|
||||
message(FATAL_ERROR "Unable to find fastrtpsgen")
|
||||
endif()
|
||||
|
||||
set(config_rtps_send_topics
|
||||
sensor_combined
|
||||
sensor_baro
|
||||
sensor_selection
|
||||
vehicle_gps_position
|
||||
airspeed
|
||||
vehicle_land_detected
|
||||
vehicle_status
|
||||
)
|
||||
if (EXISTS "${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_message_ids.yaml")
|
||||
|
||||
set(config_rtps_receive_topics
|
||||
sensor_baro
|
||||
optical_flow
|
||||
)
|
||||
set(config_rtps_send_topics)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_classifier.py -s
|
||||
OUTPUT_VARIABLE config_rtps_send_topics
|
||||
)
|
||||
|
||||
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
|
||||
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}")
|
||||
|
||||
endif()
|
||||
|
||||
if (FASTRTPSGEN AND (config_rtps_send_topics OR config_rtps_receive_topics))
|
||||
option(GENERATE_RTPS_BRIDGE "enable RTPS and microCDR" ON)
|
||||
@@ -89,6 +96,7 @@ if (GENERATE_RTPS_BRIDGE)
|
||||
endforeach()
|
||||
|
||||
# receive topic files
|
||||
message(STATUS "RTPS receive: ${config_rtps_receive_topics}")
|
||||
set(receive_topic_files)
|
||||
foreach(topic ${config_rtps_receive_topics})
|
||||
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
|
||||
|
||||
@@ -71,15 +71,9 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
|
||||
${msg_out_path}/micrortps_client/microRTPS_transport.h
|
||||
)
|
||||
|
||||
# Copy yaml file to the bin dir to be used by empy on the file generation
|
||||
configure_file("${PX4_SOURCE_DIR}/msg/tools/uorb_rtps_message_ids.yaml"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/uorb_rtps_message_ids.yaml" COPYONLY)
|
||||
|
||||
add_custom_command(OUTPUT ${topic_bridge_files_out}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/generate_microRTPS_bridge.py
|
||||
--fastrtpsgen-dir $ENV{FASTRTPSGEN_DIR}
|
||||
${send_topic_opt} ${send_topic_files}
|
||||
${receive_topic_opt} ${receive_topic_files}
|
||||
--generate-idl
|
||||
--mkdir-build
|
||||
--generate-cmakelists
|
||||
|
||||
Reference in New Issue
Block a user