first prototype of templated rcl, using non-templated middleware interface, implemented by connext using dynamic data

This commit is contained in:
Dirk Thomas 2014-07-30 17:57:21 -07:00
parent a226aecd96
commit bcecf00928
13 changed files with 416 additions and 0 deletions

16
rclcpp/CMakeLists.txt Normal file
View file

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 2.8.3)
project(rclcpp)
find_package(ament_cmake REQUIRED)
find_package(ros_middleware_interface REQUIRED)
ament_export_dependencies(ros_dds_connext_dynamic ros_middleware_interface)
ament_export_include_directories(include)
ament_package()
install(
DIRECTORY include/
DESTINATION include
)

View file

@ -0,0 +1,40 @@
#ifndef __rclcpp__Node__h__
#define __rclcpp__Node__h__
#include "Publisher.h"
#include "ros_middleware_interface/functions.h"
namespace rclcpp
{
class Node
{
public:
Node()
{
node_handle_ = ::ros_middleware_interface::create_node();
}
template<typename ROSMessage>
Publisher<ROSMessage>* create_publisher(const char * topic_name)
{
const rosidl_generator_cpp::MessageTypeSupportMembers & members = rosidl_generator_cpp::MessageTypeSupport<ROSMessage>::get_members();
void * publisher_handle = ::ros_middleware_interface::create_publisher(node_handle_, members, topic_name);
return new Publisher<ROSMessage>(publisher_handle);
}
private:
void * node_handle_;
};
}
rclcpp::Node* create_node()
{
return new rclcpp::Node();
}
#endif // __rclcpp__Node__h__

View file

@ -0,0 +1,29 @@
#ifndef __rclcpp__Publisher__h__
#define __rclcpp__Publisher__h__
#include "ros_middleware_interface/functions.h"
namespace rclcpp
{
template<typename ROSMessage>
class Publisher
{
public:
Publisher(void * publisher_handle)
: publisher_handle_(publisher_handle)
{}
void publish(const ROSMessage& ros_message)
{
::ros_middleware_interface::publish(publisher_handle_, &ros_message);
}
private:
void * publisher_handle_;
};
}
#endif // __rclcpp__Publisher__h__

15
rclcpp/package.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<package format="2">
<name>rclcpp</name>
<version>0.0.0</version>
<description>The ROS client library in C++.</description>
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>ros_middleware_interface</build_depend>
<build_depend>rosidl_default_generators</build_depend>
<build_depend>ros_dds_connext_dynamic</build_depend>
</package>