rtt_rostopic_service.cpp
Go to the documentation of this file.
00001 #include <rtt/RTT.hpp>
00002 #include <rtt/internal/GlobalService.hpp>
00003 #include <rtt_roscomm/rtt_rostopic.h> 
00004 
00005 using namespace RTT;
00006 using namespace std;
00007 
00008 void loadROSTopicService(){
00009   RTT::Service::shared_ptr ros = RTT::internal::GlobalService::Instance()->provides("ros");
00010   RTT::Service::shared_ptr roscomm = ros->provides("comm");
00011 
00012   // New topic construction operators
00013   roscomm->addConstant("protocol_id", rtt_roscomm::protocol_id);
00014 
00015   roscomm->addOperation("topic", &rtt_roscomm::topic).doc(
00016       "Creates a ConnPolicy for subscribing to or publishing a topic. No buffering is done, only the last message is kept.").arg(
00017           "name", "The ros topic name");
00018 
00019   roscomm->addOperation("topicLatched", &rtt_roscomm::topicLatched).doc(
00020       "Creates a ConnPolicy for subscribing to or publishing a latched topic. No buffering is done, only the last message is kept.").arg(
00021           "name", "The ros topic name");
00022 
00023   roscomm->addOperation("topicBuffer", &rtt_roscomm::topicBuffer).doc(
00024       "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
00025           "name", "The ros topic name").arg(
00026           "size","The size of the buffer.");
00027 
00028   roscomm->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
00029       "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
00030           "name", "The ros topic name");
00031 
00032   // Backwards-compatibility
00033   ros->addConstant("protocol_id", rtt_roscomm::protocol_id);
00034 
00035   ros->addOperation("topic", &rtt_roscomm::topic).doc(
00036       "Creates a ConnPolicy for subscribing to or publishing a topic. No buffering is done, only the last message is kept.").arg(
00037           "name", "The ros topic name");
00038   ros->addOperation("topicLatched", &rtt_roscomm::topicLatched).doc(
00039       "Creates a ConnPolicy for subscribing to or publishing a latched topic. No buffering is done, only the last message is kept.").arg(
00040           "name", "The ros topic name");
00041   ros->addOperation("topicBuffer", &rtt_roscomm::topicBuffer).doc(
00042       "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
00043           "name", "The ros topic name").arg(
00044           "size","The size of the buffer.");
00045   ros->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
00046       "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
00047           "name", "The ros topic name");
00048 }
00049 
00050 using namespace RTT;
00051 extern "C" {
00052   bool loadRTTPlugin(RTT::TaskContext* c){
00053     if (c != 0) return false;
00054     loadROSTopicService();
00055     return true;
00056   }
00057   std::string getRTTPluginName (){
00058     return "rostopic";
00059   }
00060   std::string getRTTTargetName (){
00061     return OROCOS_TARGET_NAME;
00062   }
00063 }


rtt_roscomm
Author(s): Ruben Smits, Jonathan Bohren
autogenerated on Thu Jun 6 2019 18:06:06