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("topicBuffer", &rtt_roscomm::topicBuffer).doc(
00020       "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
00021           "name", "The ros topic name").arg(
00022           "size","The size of the buffer.");
00023 
00024   roscomm->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
00025       "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
00026           "name", "The ros topic name");
00027 
00028   // Backwards-compatibility
00029   ros->addConstant("protocol_id", rtt_roscomm::protocol_id);
00030 
00031   ros->addOperation("topic", &rtt_roscomm::topic).doc(
00032       "Creates a ConnPolicy for subscribing to or publishing a topic. No buffering is done, only the last message is kept.").arg(
00033           "name", "The ros topic name");
00034   ros->addOperation("topicBuffer", &rtt_roscomm::topicBuffer).doc(
00035       "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
00036           "name", "The ros topic name").arg(
00037           "size","The size of the buffer.");
00038   ros->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
00039       "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
00040           "name", "The ros topic name");
00041 }
00042 
00043 using namespace RTT;
00044 extern "C" {
00045   bool loadRTTPlugin(RTT::TaskContext* c){
00046     if (c != 0) return false;
00047     loadROSTopicService();
00048     return true;
00049   }
00050   std::string getRTTPluginName (){
00051     return "rostopic";
00052   }
00053   std::string getRTTTargetName (){
00054     return OROCOS_TARGET_NAME;
00055   }
00056 }


rtt_roscomm
Author(s): Ruben Smits, Jonathan Bohren
autogenerated on Mon Apr 3 2017 03:34:43