35 bool getTopicBase(
const std::string& topic, std::string& topicBase) {
36 std::string tmp = topic;
37 int i = tmp.rfind(
'/');
39 while( (tmp.size() > 0) && (i >= (
int)(tmp.size()-1))) {
40 tmp = tmp.substr(0,tmp.size()-1);
50 topicBase = tmp.substr(i+1, tmp.size()-i-1);
56 if (!messageDefinition.
isValid())
67 getMessageDataType().createVariant();
76 int main(
int argc,
char **argv) {
78 printf(
"\nusage: echo TOPIC TYPE [RATE]\n\n");
83 ROS_ERROR(
"Failed to extract topic base from [%s]", argv[1]);
108 publisherTimer.
stop();
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Header file providing the Publisher class interface.
ros::NodeHandlePtr nodeHandle
variant_topic_tools::Publisher publisher
variant_topic_tools::MessageDefinition messageDefinition
ros::Timer publisherTimer
void publish(const ros::TimerEvent &event)
bool getTopicBase(const std::string &topic, std::string &topicBase)
int main(int argc, char **argv)
std::string publisherTopic
variant_topic_tools::MessageType messageType
size_t publisherQueueSize
ROSCPP_DECL void waitForShutdown()
std::string publisherType