rtt_rostopic_service.cpp
Go to the documentation of this file.
1 #include <rtt/RTT.hpp>
3 #include <rtt_roscomm/rostopic.h>
4 
5 using namespace RTT;
6 using namespace std;
7 
10  RTT::Service::shared_ptr roscomm = ros->provides("comm");
11 
12  // New topic construction operators
13  roscomm->addConstant("protocol_id", rtt_roscomm::protocol_id);
14 
15  roscomm->addOperation("topic", &rtt_roscomm::topic).doc(
16  "Creates a ConnPolicy for subscribing to or publishing a topic. No buffering is done, only the last message is kept.").arg(
17  "name", "The ros topic name");
18 
19  roscomm->addOperation("topicLatched", &rtt_roscomm::topicLatched).doc(
20  "Creates a ConnPolicy for subscribing to or publishing a latched topic. No buffering is done, only the last message is kept.").arg(
21  "name", "The ros topic name");
22 
23  roscomm->addOperation("topicBuffer", &rtt_roscomm::topicBuffer).doc(
24  "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
25  "name", "The ros topic name").arg(
26  "size","The size of the buffer.");
27 
28  roscomm->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
29  "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
30  "name", "The ros topic name");
31 
32  // Backwards-compatibility
33  ros->addConstant("protocol_id", rtt_roscomm::protocol_id);
34 
35  ros->addOperation("topic", &rtt_roscomm::topic).doc(
36  "Creates a ConnPolicy for subscribing to or publishing a topic. No buffering is done, only the last message is kept.").arg(
37  "name", "The ros topic name");
38  ros->addOperation("topicLatched", &rtt_roscomm::topicLatched).doc(
39  "Creates a ConnPolicy for subscribing to or publishing a latched topic. No buffering is done, only the last message is kept.").arg(
40  "name", "The ros topic name");
41  ros->addOperation("topicBuffer", &rtt_roscomm::topicBuffer).doc(
42  "Creates a ConnPolicy for subscribing to or publishing a topic with a fixed-length message buffer.").arg(
43  "name", "The ros topic name").arg(
44  "size","The size of the buffer.");
45  ros->addOperation("topicUnbuffered", &rtt_roscomm::topicUnbuffered).doc(
46  "Creates a ConnPolicy for unbuffered publishing a topic. This may not be real-time safe!").arg(
47  "name", "The ros topic name");
48 }
49 
50 using namespace RTT;
51 extern "C" {
53  if (c != 0) return false;
55  return true;
56  }
57  std::string getRTTPluginName (){
58  return "rostopic";
59  }
60  std::string getRTTTargetName (){
61  return OROCOS_TARGET_NAME;
62  }
63 }
RTT::ConnPolicy topicLatched(const std::string &name)
std::string getRTTTargetName()
RTT::ConnPolicy topic(const std::string &name)
Definition: rtt_rostopic.cpp:4
RTT::ConnPolicy topicBuffer(const std::string &name, int size)
bool loadRTTPlugin(RTT::TaskContext *c)
static const int protocol_id
ROS topic protocol ID.
Definition: rostopic.h:37
std::string getRTTPluginName()
RTT::ConnPolicy topicUnbuffered(const std::string &name)
void loadROSTopicService()
static RTT_API Service::shared_ptr Instance()


rtt_roscomm
Author(s): Ruben Smits, Jonathan Bohren
autogenerated on Sat Jun 8 2019 18:05:17