hide static typesupport headers
This commit is contained in:
parent
17ef4a3de2
commit
a0757ed0b4
7 changed files with 46 additions and 14 deletions
|
@ -7,8 +7,17 @@ find_package(ros_middleware_interface REQUIRED)
|
||||||
find_package(rosidl_generator_cpp REQUIRED)
|
find_package(rosidl_generator_cpp REQUIRED)
|
||||||
|
|
||||||
find_package(ndds_cpp REQUIRED)
|
find_package(ndds_cpp REQUIRED)
|
||||||
set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
#set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
||||||
set(CONNEXT_LIBRARIES ${ndds_cpp_LIBRARIES})
|
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})
|
set(CONNEXT_DEFINITIONS ${ndds_cpp_DEFINITIONS})
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +33,7 @@ ament_export_libraries(ros_dds_connext_dynamic dl pthread)
|
||||||
ament_package()
|
ament_package()
|
||||||
|
|
||||||
include_directories(${ros_middleware_interface_INCLUDE_DIRS} ${rosidl_generator_cpp_INCLUDE_DIRS} ${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_definitions(${CONNEXT_DEFINITIONS})
|
||||||
add_library(ros_dds_connext_dynamic SHARED src/functions.cpp)
|
add_library(ros_dds_connext_dynamic SHARED src/functions.cpp)
|
||||||
target_link_libraries(ros_dds_connext_dynamic ${std_msgs_LIBRARIES} ${CONNEXT_LIBRARIES})
|
target_link_libraries(ros_dds_connext_dynamic ${std_msgs_LIBRARIES} ${CONNEXT_LIBRARIES})
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
namespace ros_middleware_interface
|
namespace ros_middleware_interface
|
||||||
{
|
{
|
||||||
|
|
||||||
const char * _rti_connext_identifier = "connext_dynamic";
|
const char * _rti_connext_dynamic_identifier = "connext_dynamic";
|
||||||
|
|
||||||
ros_middleware_interface::NodeHandle create_node()
|
ros_middleware_interface::NodeHandle create_node()
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ ros_middleware_interface::NodeHandle create_node()
|
||||||
std::cout << " create_node() pass opaque node handle" << std::endl;
|
std::cout << " create_node() pass opaque node handle" << std::endl;
|
||||||
|
|
||||||
ros_middleware_interface::NodeHandle node_handle = {
|
ros_middleware_interface::NodeHandle node_handle = {
|
||||||
_rti_connext_identifier,
|
_rti_connext_dynamic_identifier,
|
||||||
participant
|
participant
|
||||||
};
|
};
|
||||||
return node_handle;
|
return node_handle;
|
||||||
|
@ -55,7 +55,7 @@ ros_middleware_interface::PublisherHandle create_publisher(const ros_middleware_
|
||||||
{
|
{
|
||||||
std::cout << "create_publisher()" << std::endl;
|
std::cout << "create_publisher()" << std::endl;
|
||||||
|
|
||||||
if (node_handle._implementation_identifier != _rti_connext_identifier)
|
if (node_handle._implementation_identifier != _rti_connext_dynamic_identifier)
|
||||||
{
|
{
|
||||||
printf("node handle not from this implementation\n");
|
printf("node handle not from this implementation\n");
|
||||||
printf("but from: %s\n", node_handle._implementation_identifier);
|
printf("but from: %s\n", node_handle._implementation_identifier);
|
||||||
|
@ -67,6 +67,13 @@ ros_middleware_interface::PublisherHandle create_publisher(const ros_middleware_
|
||||||
std::cout << " create_publisher() extract participant from opaque node handle" << std::endl;
|
std::cout << " create_publisher() extract participant from opaque node handle" << std::endl;
|
||||||
DDSDomainParticipant* participant = (DDSDomainParticipant*)node_handle._data;
|
DDSDomainParticipant* participant = (DDSDomainParticipant*)node_handle._data;
|
||||||
|
|
||||||
|
if (type_support_handle._implementation_identifier != ros_dds_cpp_dynamic_typesupport::_dynamic_identifier)
|
||||||
|
{
|
||||||
|
printf("type support not from this implementation\n");
|
||||||
|
printf("but from: %s\n", type_support_handle._implementation_identifier);
|
||||||
|
throw std::runtime_error("type support not from this implementation");
|
||||||
|
}
|
||||||
|
|
||||||
ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers * members = (ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers*)type_support_handle._data;
|
ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers * members = (ros_dds_cpp_dynamic_typesupport::MessageTypeSupportMembers*)type_support_handle._data;
|
||||||
std::string type_name = std::string(members->_package_name) + "/" + members->_message_name;
|
std::string type_name = std::string(members->_package_name) + "/" + members->_message_name;
|
||||||
|
|
||||||
|
@ -177,7 +184,7 @@ ros_middleware_interface::PublisherHandle create_publisher(const ros_middleware_
|
||||||
custom_publisher_info->dynamic_data = dynamic_data;
|
custom_publisher_info->dynamic_data = dynamic_data;
|
||||||
|
|
||||||
ros_middleware_interface::PublisherHandle publisher_handle = {
|
ros_middleware_interface::PublisherHandle publisher_handle = {
|
||||||
_rti_connext_identifier,
|
_rti_connext_dynamic_identifier,
|
||||||
custom_publisher_info
|
custom_publisher_info
|
||||||
};
|
};
|
||||||
return publisher_handle;
|
return publisher_handle;
|
||||||
|
@ -188,7 +195,7 @@ void publish(const ros_middleware_interface::PublisherHandle& publisher_handle,
|
||||||
//std::cout << "publish()" << std::endl;
|
//std::cout << "publish()" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
if (publisher_handle._implementation_identifier != _rti_connext_identifier)
|
if (publisher_handle._implementation_identifier != _rti_connext_dynamic_identifier)
|
||||||
{
|
{
|
||||||
printf("publisher handle not from this implementation\n");
|
printf("publisher handle not from this implementation\n");
|
||||||
printf("but from: %s\n", publisher_handle._implementation_identifier);
|
printf("but from: %s\n", publisher_handle._implementation_identifier);
|
||||||
|
|
|
@ -8,8 +8,17 @@ find_package(rosidl_generator_cpp REQUIRED)
|
||||||
find_package(rosidl_generator_dds_connext_cpp REQUIRED)
|
find_package(rosidl_generator_dds_connext_cpp REQUIRED)
|
||||||
|
|
||||||
find_package(ndds_cpp REQUIRED)
|
find_package(ndds_cpp REQUIRED)
|
||||||
set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
#set(CONNEXT_INCLUDE_DIRS ${ndds_cpp_INCLUDE_DIRS})
|
||||||
set(CONNEXT_LIBRARIES ${ndds_cpp_LIBRARIES})
|
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})
|
set(CONNEXT_DEFINITIONS ${ndds_cpp_DEFINITIONS})
|
||||||
|
|
||||||
ament_export_definitions(${CONNEXT_DEFINITIONS})
|
ament_export_definitions(${CONNEXT_DEFINITIONS})
|
||||||
|
@ -24,6 +33,7 @@ ament_package(
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(include ${ros_middleware_interface_INCLUDE_DIRS} ${rosidl_generator_cpp_INCLUDE_DIRS} ${rosidl_generator_dds_connext_cpp_INCLUDE_DIRS} ${CONNEXT_INCLUDE_DIRS})
|
include_directories(include ${ros_middleware_interface_INCLUDE_DIRS} ${rosidl_generator_cpp_INCLUDE_DIRS} ${rosidl_generator_dds_connext_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_definitions(${CONNEXT_DEFINITIONS})
|
||||||
add_library(ros_dds_connext_static SHARED src/functions.cpp)
|
add_library(ros_dds_connext_static SHARED src/functions.cpp)
|
||||||
target_link_libraries(ros_dds_connext_static ${std_msgs_LIBRARIES} ${rosidl_generator_dds_connext_cpp_LIBRARIES} ${CONNEXT_LIBRARIES})
|
target_link_libraries(ros_dds_connext_static ${std_msgs_LIBRARIES} ${rosidl_generator_dds_connext_cpp_LIBRARIES} ${CONNEXT_LIBRARIES})
|
||||||
|
|
|
@ -5,10 +5,15 @@
|
||||||
class DDSDomainParticipant;
|
class DDSDomainParticipant;
|
||||||
class DDSDataWriter;
|
class DDSDataWriter;
|
||||||
|
|
||||||
namespace ros_dds_connext_static
|
namespace ros_middleware_interface
|
||||||
{
|
{
|
||||||
|
|
||||||
const char * _connext_static_identifier = "connext_static";
|
extern const char * _rti_connext_identifier;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ros_dds_connext_static
|
||||||
|
{
|
||||||
|
|
||||||
typedef struct MessageTypeSupportCallbacks {
|
typedef struct MessageTypeSupportCallbacks {
|
||||||
const char * _package_name;
|
const char * _package_name;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static ros_dds_connext_static::MessageTypeSupportCallbacks callbacks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static rosidl_generator_cpp::MessageTypeSupportHandle handle = {
|
static rosidl_generator_cpp::MessageTypeSupportHandle handle = {
|
||||||
ros_dds_connext_static::_connext_static_identifier,
|
ros_middleware_interface::_rti_connext_identifier,
|
||||||
&callbacks
|
&callbacks
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3)
|
||||||
|
|
||||||
project(userland)
|
project(userland)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++0x")
|
set(CMAKE_CXX_FLAGS "-std=c++0x -Wall")
|
||||||
|
|
||||||
find_package(ros_middleware_interface REQUIRED)
|
find_package(ros_middleware_interface REQUIRED)
|
||||||
find_package(ros_dds_connext_dynamic REQUIRED)
|
find_package(ros_dds_connext_dynamic REQUIRED)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "std_msgs/Int32.h"
|
#include "std_msgs/Int32.h"
|
||||||
|
|
||||||
|
|
||||||
main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
rclcpp::Node* n = create_node();
|
rclcpp::Node* n = create_node();
|
||||||
rclcpp::Publisher<std_msgs::Int32>* p = n->create_publisher<std_msgs::Int32>("topic_name");
|
rclcpp::Publisher<std_msgs::Int32>* p = n->create_publisher<std_msgs::Int32>("topic_name");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue