add ros_dds_connext_static
This commit is contained in:
parent
6b07c8f928
commit
666a4b51c9
13 changed files with 668 additions and 17 deletions
|
@ -5,19 +5,52 @@ project(ros_dds_connext_dynamic)
|
|||
find_package(ament_cmake REQUIRED)
|
||||
find_package(ros_middleware_interface REQUIRED)
|
||||
find_package(rosidl_generator_cpp REQUIRED)
|
||||
find_package(ros_dds_cpp_dynamic_typesupport REQUIRED)
|
||||
|
||||
find_package(ndds_cpp REQUIRED)
|
||||
set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
||||
set(CONNEXT_LIBRARIES ${ndds_cpp_LIBRARIES})
|
||||
#set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
||||
set(CONNEXT_INCLUDE_DIRS
|
||||
"/home/dthomas/RTI/ndds.5.1.0/include/ndds"
|
||||
"/home/dthomas/RTI/ndds.5.1.0/include"
|
||||
)
|
||||
#set(CONNEXT_LIBRARIES ${ndds_cpp_LIBRARIES})
|
||||
set(CONNEXT_LIBRARIES
|
||||
"/home/dthomas/RTI/ndds.5.1.0/lib/x64Linux2.6gcc4.4.5/libnddscppz.a"
|
||||
"/home/dthomas/RTI/ndds.5.1.0/lib/x64Linux2.6gcc4.4.5/libnddscz.a"
|
||||
"/home/dthomas/RTI/ndds.5.1.0/lib/x64Linux2.6gcc4.4.5/libnddscorez.a"
|
||||
)
|
||||
set(CONNEXT_DEFINITIONS ${ndds_cpp_DEFINITIONS})
|
||||
|
||||
ament_export_dependencies(ros_middleware_interface rosidl_generator_cpp ros_dds_cpp_dynamic_typesupport)
|
||||
|
||||
set(_dds_vendor "$ENV{ROS_DDS_IMPLEMENTATION}")
|
||||
set(_dds_type "$ENV{ROS_DDS_TYPE}")
|
||||
if("${_dds_type}" STREQUAL "dynamic")
|
||||
find_package(ros_dds_cpp_dynamic_typesupport REQUIRED)
|
||||
ament_export_dependencies(ros_dds_cpp_dynamic_typesupport)
|
||||
include_directories(${ros_dds_cpp_dynamic_typesupport_INCLUDE_DIRS})
|
||||
elseif("${_dds_type}" STREQUAL "static")
|
||||
if("${_dds_vendor}" STREQUAL "connext")
|
||||
find_package(ros_dds_connext_static REQUIRED)
|
||||
ament_export_definitions(${CONNEXT_DEFINITIONS})
|
||||
ament_export_dependencies(ros_dds_connext_static)
|
||||
include_directories(${ros_dds_connext_static_INCLUDE_DIRS})
|
||||
elseif("${_dds_vendor}" STREQUAL "opensplice")
|
||||
message(FATAL_ERROR "The DDS implementation '${_dds_vendor}' does not yet support the type '${_dds_type}'.")
|
||||
else()
|
||||
message(FATAL_ERROR "Set the environment variable 'ROS_DDS_IMPLEMENTATION' to either 'connext' or 'opensplice'.")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Set the environment variable 'ROS_DDS_TYPE' to either 'dynamic' or 'static'.")
|
||||
endif()
|
||||
|
||||
|
||||
ament_export_dependencies(ros_middleware_interface rosidl_generator_cpp)
|
||||
|
||||
ament_export_libraries(ros_dds_connext_dynamic dl pthread)
|
||||
|
||||
ament_package()
|
||||
|
||||
include_directories(${ros_middleware_interface_INCLUDE_DIRS} ${rosidl_generator_cpp} ${ros_dds_cpp_dynamic_typesupport} ${CONNEXT_INCLUDE_DIRS})
|
||||
include_directories(${ros_middleware_interface_INCLUDE_DIRS} ${rosidl_generator_cpp_INCLUDE_DIRS} ${CONNEXT_INCLUDE_DIRS})
|
||||
link_directories("/home/dthomas/RTI/ndds.5.1.0/lib/x64Linux2.6gcc4.4.5")
|
||||
add_definitions(${CONNEXT_DEFINITIONS})
|
||||
add_library(ros_dds_connext_dynamic SHARED src/functions.cpp)
|
||||
target_link_libraries(ros_dds_connext_dynamic ${std_msgs_LIBRARIES} ${CONNEXT_LIBRARIES})
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace ros_middleware_interface
|
||||
{
|
||||
|
||||
const char * _rti_connext_identifier = "connext";
|
||||
const char * _rti_connext_identifier = "connext_dynamic";
|
||||
|
||||
ros_middleware_interface::NodeHandle create_node()
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ ros_middleware_interface::NodeHandle create_node()
|
|||
return node_handle;
|
||||
}
|
||||
|
||||
struct TypeCodeAndDataWriter {
|
||||
struct CustomPublisherInfo {
|
||||
DDSDynamicDataWriter * dynamic_writer_;
|
||||
DDS_TypeCode * type_code_;
|
||||
ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers * members_;
|
||||
|
@ -164,14 +164,14 @@ ros_middleware_interface::PublisherHandle create_publisher(const ros_middleware_
|
|||
|
||||
|
||||
std::cout << " create_publisher() build opaque publisher handle" << std::endl;
|
||||
TypeCodeAndDataWriter* type_code_and_data_writer = new TypeCodeAndDataWriter();
|
||||
type_code_and_data_writer->dynamic_writer_ = dynamic_writer;
|
||||
type_code_and_data_writer->type_code_ = type_code;
|
||||
type_code_and_data_writer->members_ = members;
|
||||
CustomPublisherInfo* custom_publisher_info = new CustomPublisherInfo();
|
||||
custom_publisher_info->dynamic_writer_ = dynamic_writer;
|
||||
custom_publisher_info->type_code_ = type_code;
|
||||
custom_publisher_info->members_ = members;
|
||||
|
||||
ros_middleware_interface::PublisherHandle publisher_handle = {
|
||||
_rti_connext_identifier,
|
||||
type_code_and_data_writer
|
||||
custom_publisher_info
|
||||
};
|
||||
return publisher_handle;
|
||||
}
|
||||
|
@ -189,10 +189,10 @@ void publish(const ros_middleware_interface::PublisherHandle& publisher_handle,
|
|||
}
|
||||
|
||||
std::cout << " publish() extract data writer and type code from opaque publisher handle" << std::endl;
|
||||
TypeCodeAndDataWriter * type_code_and_data_writer = (TypeCodeAndDataWriter*)publisher_handle._data;
|
||||
DDSDynamicDataWriter * dynamic_writer = type_code_and_data_writer->dynamic_writer_;
|
||||
DDS_TypeCode * type_code = type_code_and_data_writer->type_code_;
|
||||
const ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers * members = type_code_and_data_writer->members_;
|
||||
CustomPublisherInfo * custom_publisher_info = (CustomPublisherInfo*)publisher_handle._data;
|
||||
DDSDynamicDataWriter * dynamic_writer = custom_publisher_info->dynamic_writer_;
|
||||
DDS_TypeCode * type_code = custom_publisher_info->type_code_;
|
||||
const ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers * members = custom_publisher_info->members_;
|
||||
|
||||
std::cout << " publish() create " << members->_package_name << "/" << members->_message_name << " and populate dynamic data" << std::endl;
|
||||
DDS_DynamicData dynamic_data(type_code, DDS_DYNAMIC_DATA_PROPERTY_DEFAULT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue