forked from Archive/PX4-Autopilot
uORB generation move to msg/
This commit is contained in:
parent
03784c6b01
commit
48f1e3ed1c
|
@ -1,8 +1,3 @@
|
||||||
*.d
|
|
||||||
!ROMFS/*/*.d
|
|
||||||
!ROMFS/*/*/*.d
|
|
||||||
!ROMFS/*/*/*/*.d
|
|
||||||
*.px4log
|
|
||||||
*.dSYM
|
*.dSYM
|
||||||
*.o
|
*.o
|
||||||
*.gch
|
*.gch
|
||||||
|
@ -17,8 +12,6 @@
|
||||||
.settings
|
.settings
|
||||||
.swp
|
.swp
|
||||||
.~lock.*
|
.~lock.*
|
||||||
Archives/*
|
|
||||||
Build/*
|
|
||||||
Testing/
|
Testing/
|
||||||
Packages/*
|
Packages/*
|
||||||
s3deploy-branch/
|
s3deploy-branch/
|
||||||
|
@ -62,13 +55,6 @@ GTAGS
|
||||||
*.creator.user
|
*.creator.user
|
||||||
*.files
|
*.files
|
||||||
*.includes
|
*.includes
|
||||||
src/modules/micrortps_bridge/micrortps_agent/
|
|
||||||
src/modules/micrortps_bridge/micrortps_listener/
|
|
||||||
|
|
||||||
# uavcan firmware
|
|
||||||
ROMFS/px4fmu_common/uavcan/
|
|
||||||
vectorcontrol/
|
|
||||||
|
|
||||||
|
|
||||||
# CLion ignores
|
# CLion ignores
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
path = src/modules/uavcan/libuavcan
|
path = src/modules/uavcan/libuavcan
|
||||||
url = https://github.com/UAVCAN/libuavcan.git
|
url = https://github.com/UAVCAN/libuavcan.git
|
||||||
[submodule "Tools/genmsg"]
|
[submodule "Tools/genmsg"]
|
||||||
path = Tools/genmsg
|
path = msg/tools/genmsg
|
||||||
url = https://github.com/ros/genmsg.git
|
url = https://github.com/ros/genmsg.git
|
||||||
[submodule "Tools/gencpp"]
|
[submodule "Tools/gencpp"]
|
||||||
path = Tools/gencpp
|
path = msg/tools/gencpp
|
||||||
url = https://github.com/ros/gencpp.git
|
url = https://github.com/ros/gencpp.git
|
||||||
[submodule "Tools/jMAVSim"]
|
[submodule "Tools/jMAVSim"]
|
||||||
path = Tools/jMAVSim
|
path = Tools/jMAVSim
|
||||||
|
|
|
@ -192,8 +192,6 @@ px4_add_git_submodule(TARGET git_ecl PATH "src/lib/ecl")
|
||||||
px4_add_git_submodule(TARGET git_gazebo PATH "Tools/sitl_gazebo")
|
px4_add_git_submodule(TARGET git_gazebo PATH "Tools/sitl_gazebo")
|
||||||
px4_add_git_submodule(TARGET git_gazebo_flow PATH "Tools/sitl_gazebo/external/OpticalFlow")
|
px4_add_git_submodule(TARGET git_gazebo_flow PATH "Tools/sitl_gazebo/external/OpticalFlow")
|
||||||
px4_add_git_submodule(TARGET git_gazebo_klt PATH "Tools/sitl_gazebo/external/OpticalFlow/external/klt_feature_tracker")
|
px4_add_git_submodule(TARGET git_gazebo_klt PATH "Tools/sitl_gazebo/external/OpticalFlow/external/klt_feature_tracker")
|
||||||
px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp")
|
|
||||||
px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg")
|
|
||||||
px4_add_git_submodule(TARGET git_gps_devices PATH "src/drivers/gps/devices")
|
px4_add_git_submodule(TARGET git_gps_devices PATH "src/drivers/gps/devices")
|
||||||
px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim")
|
px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim")
|
||||||
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
|
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
|
||||||
|
@ -361,16 +359,9 @@ add_definitions(${definitions})
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# message, and airframe generation
|
# message, and airframe generation
|
||||||
#
|
#
|
||||||
|
|
||||||
include(common/px4_metadata)
|
include(common/px4_metadata)
|
||||||
|
|
||||||
add_subdirectory(msg)
|
add_subdirectory(msg)
|
||||||
px4_generate_messages(TARGET msg_gen
|
|
||||||
MSG_FILES ${msg_files}
|
|
||||||
OS ${OS}
|
|
||||||
INCLUDES ${msg_include_paths}
|
|
||||||
DEPENDS prebuild_targets
|
|
||||||
)
|
|
||||||
|
|
||||||
px4_generate_airframes_xml(BOARD ${BOARD})
|
px4_generate_airframes_xml(BOARD ${BOARD})
|
||||||
|
|
||||||
|
|
|
@ -37,135 +37,9 @@
|
||||||
#
|
#
|
||||||
# utility functions
|
# utility functions
|
||||||
#
|
#
|
||||||
# * px4_generate_messages
|
|
||||||
# * px4_generate_airframes_xml
|
# * px4_generate_airframes_xml
|
||||||
#
|
#
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
# px4_generate_messages
|
|
||||||
#
|
|
||||||
# This function generates source code from ROS msg definitions.
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# px4_generate_messages(TARGET <target> MSGS <msg-files>)
|
|
||||||
#
|
|
||||||
# Input:
|
|
||||||
# MSG_FILES : the ROS msgs to generate files from
|
|
||||||
# OS : the operating system selected
|
|
||||||
# DEPENDS : dependencies
|
|
||||||
#
|
|
||||||
# Output:
|
|
||||||
# TARGET : the message generation target
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# px4_generate_messages(TARGET <target>
|
|
||||||
# MSG_FILES <files> OS <operating-system>
|
|
||||||
# [ DEPENDS <dependencies> ]
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
function(px4_generate_messages)
|
|
||||||
px4_parse_function_args(
|
|
||||||
NAME px4_generate_messages
|
|
||||||
OPTIONS VERBOSE
|
|
||||||
ONE_VALUE OS TARGET
|
|
||||||
MULTI_VALUE MSG_FILES DEPENDS INCLUDES
|
|
||||||
REQUIRED MSG_FILES OS TARGET
|
|
||||||
ARGN ${ARGN})
|
|
||||||
|
|
||||||
set(QUIET)
|
|
||||||
if (NOT VERBOSE)
|
|
||||||
set(QUIET "-q")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# headers
|
|
||||||
set(msg_out_path ${PX4_BINARY_DIR}/src/modules/uORB/topics)
|
|
||||||
set(msg_list)
|
|
||||||
foreach(msg_file ${MSG_FILES})
|
|
||||||
get_filename_component(msg ${msg_file} NAME_WE)
|
|
||||||
list(APPEND msg_list ${msg})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(msg_files_out)
|
|
||||||
foreach(msg ${msg_list})
|
|
||||||
list(APPEND msg_files_out ${msg_out_path}/${msg}.h)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${msg_files_out}
|
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
|
||||||
Tools/px_generate_uorb_topic_files.py
|
|
||||||
--headers
|
|
||||||
${QUIET}
|
|
||||||
-f ${MSG_FILES}
|
|
||||||
-i ${INCLUDES}
|
|
||||||
-o ${msg_out_path}
|
|
||||||
-e msg/templates/uorb
|
|
||||||
-t ${PX4_BINARY_DIR}/topics_temporary_header
|
|
||||||
DEPENDS ${DEPENDS} ${MSG_FILES}
|
|
||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
|
||||||
COMMENT "Generating uORB topic headers"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
|
|
||||||
# !sources
|
|
||||||
set(msg_source_out_path ${PX4_BINARY_DIR}/topics_sources)
|
|
||||||
set(msg_source_files_out ${msg_source_out_path}/uORBTopics.cpp)
|
|
||||||
foreach(msg ${msg_list})
|
|
||||||
list(APPEND msg_source_files_out ${msg_source_out_path}/${msg}.cpp)
|
|
||||||
endforeach()
|
|
||||||
add_custom_command(OUTPUT ${msg_source_files_out}
|
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
|
||||||
Tools/px_generate_uorb_topic_files.py
|
|
||||||
--sources
|
|
||||||
${QUIET}
|
|
||||||
-f ${MSG_FILES}
|
|
||||||
-i ${INCLUDES}
|
|
||||||
-o ${msg_source_out_path}
|
|
||||||
-e msg/templates/uorb
|
|
||||||
-t ${PX4_BINARY_DIR}/topics_temporary_sources
|
|
||||||
DEPENDS ${DEPENDS} ${MSG_FILES}
|
|
||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
|
||||||
COMMENT "Generating uORB topic sources"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
set_source_files_properties(${msg_source_files_out} PROPERTIES GENERATED TRUE)
|
|
||||||
|
|
||||||
# multi messages for target OS
|
|
||||||
set(msg_multi_out_path ${PX4_BINARY_DIR}/src/platforms/${OS}/px4_messages)
|
|
||||||
set(msg_multi_files_out)
|
|
||||||
foreach(msg ${msg_list})
|
|
||||||
list(APPEND msg_multi_files_out ${msg_multi_out_path}/px4_${msg}.h)
|
|
||||||
endforeach()
|
|
||||||
add_custom_command(OUTPUT ${msg_multi_files_out}
|
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
|
||||||
Tools/px_generate_uorb_topic_files.py
|
|
||||||
--headers
|
|
||||||
${QUIET}
|
|
||||||
-f ${MSG_FILES}
|
|
||||||
-i ${INCLUDES}
|
|
||||||
-o ${msg_multi_out_path}
|
|
||||||
-e msg/templates/px4/uorb
|
|
||||||
-t ${PX4_BINARY_DIR}/multi_topics_temporary/${OS}
|
|
||||||
-p "px4_"
|
|
||||||
DEPENDS ${DEPENDS} ${MSG_FILES}
|
|
||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
|
||||||
COMMENT "Generating uORB topic multi headers for ${OS}"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
|
|
||||||
px4_add_library(${TARGET}
|
|
||||||
${msg_source_files_out}
|
|
||||||
${msg_multi_files_out}
|
|
||||||
${msg_files_out}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${TARGET}
|
|
||||||
PRIVATE ${PX4_SOURCE_DIR}/src/lib/micro-CDR/include
|
|
||||||
PRIVATE ${PX4_BINARY_DIR}/src/lib/micro-CDR/include/microcdr
|
|
||||||
)
|
|
||||||
target_link_libraries(${TARGET} PRIVATE lib__micro-CDR)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
#
|
#
|
||||||
# px4_generate_airframes_xml
|
# px4_generate_airframes_xml
|
||||||
|
|
|
@ -114,8 +114,8 @@ set(config_module_list
|
||||||
modules/systemlib/mixer
|
modules/systemlib/mixer
|
||||||
modules/uORB
|
modules/uORB
|
||||||
|
|
||||||
# micro RTPS
|
# micro RTPS
|
||||||
modules/micrortps_bridge/micrortps_client
|
modules/micrortps_bridge/micrortps_client
|
||||||
|
|
||||||
#
|
#
|
||||||
# Libraries
|
# Libraries
|
||||||
|
@ -231,4 +231,3 @@ if(REPLAY_FILE)
|
||||||
message("Building with uorb publisher rules support")
|
message("Building with uorb publisher rules support")
|
||||||
add_definitions(-DORB_USE_PUBLISHER_RULES)
|
add_definitions(-DORB_USE_PUBLISHER_RULES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/modules/uORB}""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
||||||
|
@ -54,7 +53,6 @@
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/modules/uORB}""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
||||||
|
@ -83,7 +81,6 @@
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/modules/systemlib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/modules/systemlib}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/lib/geo}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/platforms}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/modules/uORB}""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/src/include}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware/uORB/topics}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/PX4-Firmware}""/>
|
||||||
|
|
|
@ -59,11 +59,11 @@
|
||||||
<variableList>
|
<variableList>
|
||||||
<variable>
|
<variable>
|
||||||
<name>uORB_LOC</name>
|
<name>uORB_LOC</name>
|
||||||
<value>$%7BPROJECT_LOC%7D/build/posix_sitl_default/src/modules/uORB</value>
|
<value>$%7BPROJECT_LOC%7D/build/posix_sitl_default/uORB</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable>
|
<variable>
|
||||||
<name>uORB_SRC</name>
|
<name>uORB_SRC</name>
|
||||||
<value>$%7BPROJECT_LOC%7D/build/posix_sitl_default/topics_sources</value>
|
<value>$%7BPROJECT_LOC%7D/build/posix_sitl_default/msg/topics_sources</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variableList>
|
</variableList>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
set(msg_file_names
|
set(msg_files
|
||||||
actuator_armed.msg
|
actuator_armed.msg
|
||||||
actuator_controls.msg
|
actuator_controls.msg
|
||||||
actuator_direct.msg
|
actuator_direct.msg
|
||||||
|
@ -127,17 +127,63 @@ set(msg_file_names
|
||||||
wind_estimate.msg
|
wind_estimate.msg
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get absolute paths
|
px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp")
|
||||||
set(msg_files)
|
px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg")
|
||||||
set(msg_include_paths)
|
|
||||||
|
|
||||||
foreach(msg_file ${msg_file_names})
|
# headers
|
||||||
list(APPEND msg_files ${CMAKE_CURRENT_SOURCE_DIR}/${msg_file})
|
set(msg_out_path ${PX4_BINARY_DIR}/uORB/topics)
|
||||||
|
set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources)
|
||||||
|
#set(msg_source_files_out ${CMAKE_CURRENT_BINARY_DIR}/uORBTopics.cpp)
|
||||||
|
|
||||||
|
set(msg_list)
|
||||||
|
set(uorb_headers)
|
||||||
|
set(uorb_sources ${msg_source_out_path}/uORBTopics.cpp)
|
||||||
|
foreach(msg_file ${msg_files})
|
||||||
|
get_filename_component(msg ${msg_file} NAME_WE)
|
||||||
|
list(APPEND msg_list ${msg})
|
||||||
|
list(APPEND uorb_headers ${msg_out_path}/${msg}.h)
|
||||||
|
list(APPEND uorb_sources ${msg_source_out_path}/${msg}.cpp)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
list(APPEND msg_include_paths ${CMAKE_CURRENT_SOURCE_DIR})
|
# Generate uORB headers
|
||||||
set(msg_include_paths ${msg_include_paths} PARENT_SCOPE)
|
add_custom_command(OUTPUT ${uorb_headers}
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
|
||||||
|
--headers
|
||||||
|
-f ${msg_files}
|
||||||
|
-i ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
-o ${msg_out_path}
|
||||||
|
-e templates/uorb
|
||||||
|
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/headers
|
||||||
|
-q
|
||||||
|
DEPENDS ${msg_files}
|
||||||
|
COMMENT "Generating uORB topic headers"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(uorb_headers DEPENDS ${uorb_headers})
|
||||||
|
|
||||||
set(msg_files ${msg_files} PARENT_SCOPE)
|
# Generate uORB sources
|
||||||
|
add_custom_command(OUTPUT ${uorb_sources}
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
|
||||||
|
--sources
|
||||||
|
-f ${msg_files}
|
||||||
|
-i ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
-o ${msg_source_out_path}
|
||||||
|
-e templates/uorb
|
||||||
|
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/sources
|
||||||
|
-q
|
||||||
|
DEPENDS ${msg_files}
|
||||||
|
COMMENT "Generating uORB topic sources"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
add_library(uorb_msgs STATIC EXCLUDE_FROM_ALL ${uorb_sources})
|
||||||
|
add_dependencies(uorb_msgs uorb_headers prebuild_targets)
|
||||||
|
|
||||||
|
# microCDR now part of uORB
|
||||||
|
target_include_directories(uorb_msgs
|
||||||
|
PRIVATE ${PX4_SOURCE_DIR}/src/lib/micro-CDR/include
|
||||||
|
PRIVATE ${PX4_BINARY_DIR}/src/lib/micro-CDR/include/microcdr
|
||||||
|
)
|
||||||
|
target_link_libraries(uorb_msgs PRIVATE lib__micro-CDR)
|
||||||
|
|
|
@ -74,8 +74,7 @@ topic_fields = ["uint64_t timestamp"]+["%s %s" % (convert_type(field.type), fiel
|
||||||
constexpr char __orb_@(topic_name)_fields[] = "@( ";".join(topic_fields) );";
|
constexpr char __orb_@(topic_name)_fields[] = "@( ";".join(topic_fields) );";
|
||||||
|
|
||||||
@[for multi_topic in topics]@
|
@[for multi_topic in topics]@
|
||||||
ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size),
|
ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size), __orb_@(topic_name)_fields);
|
||||||
__orb_@(topic_name)_fields);
|
|
||||||
@[end for]
|
@[end for]
|
||||||
|
|
||||||
@#################################################
|
@#################################################
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
import sys, os, argparse, shutil
|
import sys, os, argparse, shutil
|
||||||
import px_generate_uorb_topic_files
|
import px_generate_uorb_topic_files
|
||||||
import subprocess, glob
|
import subprocess, glob
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
def get_absolute_path(arg_parse_dir):
|
def get_absolute_path(arg_parse_dir):
|
||||||
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
@ -47,7 +47,7 @@ import sys
|
||||||
px4_tools_dir = os.path.dirname(os.path.abspath(__file__))
|
px4_tools_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
sys.path.append(px4_tools_dir + "/genmsg/src")
|
sys.path.append(px4_tools_dir + "/genmsg/src")
|
||||||
sys.path.append(px4_tools_dir + "/gencpp/src")
|
sys.path.append(px4_tools_dir + "/gencpp/src")
|
||||||
px4_msg_dir = os.path.join(px4_tools_dir,"../msg")
|
px4_msg_dir = os.path.join(px4_tools_dir, "..")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import em
|
import em
|
|
@ -47,73 +47,77 @@ if(NOT GENERATE_RTPS_BRIDGE MATCHES "off")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(.)
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
include_directories(${PX4_SOURCE_DIR}/src/lib/micro-CDR/include)
|
|
||||||
include_directories(${PX4_BINARY_DIR}/src/lib/micro-CDR/include/microcdr)
|
|
||||||
|
|
||||||
# Do not delete everything in the current dir
|
# Do not delete everything in the current dir
|
||||||
set(msg_out_path ${CMAKE_CURRENT_BINARY_DIR})
|
set(msg_out_path ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set(topic_msg_path ${PX4_SOURCE_DIR}/msg)
|
|
||||||
|
|
||||||
set(send_topic_files)
|
if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_topics}" STREQUAL "")
|
||||||
foreach(topic ${config_rtps_send_topics})
|
|
||||||
list(APPEND send_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(receive_topic_files)
|
set(send_topic_files)
|
||||||
foreach(topic ${config_rtps_receive_topics})
|
foreach(topic ${config_rtps_send_topics})
|
||||||
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
|
list(APPEND send_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(topic ${config_rtps_send_topics})
|
set(receive_topic_files)
|
||||||
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.cpp)
|
foreach(topic ${config_rtps_receive_topics})
|
||||||
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.h)
|
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(topic ${config_rtps_receive_topics})
|
foreach(topic ${config_rtps_send_topics})
|
||||||
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.cpp)
|
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.cpp)
|
||||||
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.h)
|
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.h)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_topics}" STREQUAL "")
|
foreach(topic ${config_rtps_receive_topics})
|
||||||
set(topic_bridge_files_out microRTPS_client.cpp microRTPS_transport.cpp microRTPS_transport.h)
|
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.cpp)
|
||||||
|
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.h)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
set(send_topic_files_opt)
|
set(send_topic_files_opt)
|
||||||
if (NOT "${send_topic_files}" STREQUAL "")
|
if (NOT "${send_topic_files}" STREQUAL "")
|
||||||
set(send_topic_opt "-s")
|
set(send_topic_opt "--send")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(receive_topic_files_opt)
|
set(receive_topic_files_opt)
|
||||||
if (NOT "${receive_topic_files}" STREQUAL "")
|
if (NOT "${receive_topic_files}" STREQUAL "")
|
||||||
set(receive_topic_opt "-r")
|
set(receive_topic_opt "--receive")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${topic_bridge_files_out}
|
list(APPEND topic_bridge_files_out
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
${msg_out_path}/micrortps_client/microRTPS_client.cpp
|
||||||
${PX4_SOURCE_DIR}/Tools/generate_microRTPS_bridge.py
|
${msg_out_path}/micrortps_client/microRTPS_transport.cpp
|
||||||
-f $ENV{FASTRTPSGEN_DIR}
|
${msg_out_path}/micrortps_client/microRTPS_transport.h
|
||||||
${send_topic_opt} ${send_topic_files}
|
)
|
||||||
${receive_topic_opt} ${receive_topic_files}
|
|
||||||
-t ${topic_msg_path}
|
|
||||||
-u ${msg_out_path}
|
|
||||||
DEPENDS ${DEPENDS} ${send_topic_files} ${receive_topic_files}
|
|
||||||
COMMENT "Generating RTPS topic bridge"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
add_custom_target(topic_bridge_files DEPENDS ${topic_bridge_files_out})
|
|
||||||
|
|
||||||
px4_add_module(
|
add_custom_command(OUTPUT ${topic_bridge_files_out}
|
||||||
MODULE modules__micrortps_bridge__micrortps_client
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/msg/tools/generate_microRTPS_bridge.py
|
||||||
MAIN micrortps_client
|
--fastrtpsgen-dir $ENV{FASTRTPSGEN_DIR}
|
||||||
STACK_MAIN 4096
|
${send_topic_opt} ${send_topic_files}
|
||||||
SRCS
|
${receive_topic_opt} ${receive_topic_files}
|
||||||
${msg_out_path}/microRTPS_transport.cpp
|
--topic-msg-dir ${PX4_SOURCE_DIR}/msg
|
||||||
${msg_out_path}/microRTPS_client.cpp
|
--agent-outdir ${CMAKE_CURRENT_BINARY_DIR}/micrortps_agent
|
||||||
microRTPS_client_main.cpp
|
--client-outdir ${CMAKE_CURRENT_BINARY_DIR}/micrortps_client
|
||||||
DEPENDS
|
DEPENDS ${send_topic_files} ${receive_topic_files}
|
||||||
platforms__common
|
COMMENT "Generating RTPS topic bridge"
|
||||||
topic_bridge_files
|
VERBATIM
|
||||||
)
|
)
|
||||||
endif()
|
add_custom_target(topic_bridge_files DEPENDS ${topic_bridge_files_out})
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/micrortps_client)
|
||||||
|
|
||||||
|
px4_add_module(
|
||||||
|
MODULE modules__micrortps_bridge__micrortps_client
|
||||||
|
MAIN micrortps_client
|
||||||
|
STACK_MAIN 4096
|
||||||
|
SRCS
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/micrortps_client/microRTPS_transport.cpp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/micrortps_client/microRTPS_client.cpp
|
||||||
|
microRTPS_client_main.cpp
|
||||||
|
DEPENDS
|
||||||
|
platforms__common
|
||||||
|
topic_bridge_files
|
||||||
|
uorb_headers
|
||||||
|
)
|
||||||
|
target_link_libraries(modules__micrortps_bridge__micrortps_client PRIVATE lib__micro-CDR)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
|
@ -49,3 +49,4 @@ px4_add_module(
|
||||||
DEPENDS
|
DEPENDS
|
||||||
platforms__common
|
platforms__common
|
||||||
)
|
)
|
||||||
|
target_link_libraries(modules__uORB uorb_msgs)
|
||||||
|
|
|
@ -30,10 +30,6 @@
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
set(depends
|
|
||||||
msg_gen
|
|
||||||
prebuild_targets
|
|
||||||
)
|
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE platforms__common
|
MODULE platforms__common
|
||||||
|
@ -42,6 +38,7 @@ px4_add_module(
|
||||||
px4_getopt.c
|
px4_getopt.c
|
||||||
shutdown.cpp
|
shutdown.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${depends}
|
prebuild_targets
|
||||||
|
uorb_headers
|
||||||
)
|
)
|
||||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||||
|
|
|
@ -33,11 +33,12 @@
|
||||||
|
|
||||||
add_custom_command(OUTPUT topic_listener.cpp
|
add_custom_command(OUTPUT topic_listener.cpp
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_listener.py ${PX4_SOURCE_DIR} > topic_listener.cpp
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_listener.py ${PX4_SOURCE_DIR} > topic_listener.cpp
|
||||||
DEPENDS generate_listener.py msg_gen
|
DEPENDS generate_listener.py uorb_headers
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(generate_topic_listener
|
add_custom_target(generate_topic_listener
|
||||||
DEPENDS topic_listener.cpp generate_listener.py)
|
DEPENDS topic_listener.cpp generate_listener.py
|
||||||
|
)
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE systemcmds__topic_listener
|
MODULE systemcmds__topic_listener
|
||||||
|
|
Loading…
Reference in New Issue