MipBaselib::ROSiFace< msg_type, msg_type_ptr > Class Template Reference
[ROS interface]

A simple class to handle Publisher and Subscriber on a topic. More...

#include <ROSiFace.h>

Inheritance diagram for MipBaselib::ROSiFace< msg_type, msg_type_ptr >:

MipBaselib::ROSiFaceBoss

List of all members.

Public Member Functions

 ROSiFace (const string &topicName, ros::NodeHandle *_node, ROSiFaceOpeningModes op, int queue=1, int bufferDim=1)
 Complete constructor.
 ~ROSiFace ()
 Destructor.
bool sendMessage (const msg_type &message)
 Send message on topic.
bool updateMessage ()
 Update message in topic.
bool getMessage (msg_type &msg)
 Get message from topic.
void getMsgList (deque< msg_type > &listMsg)
 Get the stored messages in the list.


Detailed Description

template<class msg_type, typename msg_type_ptr>
class MipBaselib::ROSiFace< msg_type, msg_type_ptr >

A simple class to handle Publisher and Subscriber on a topic.

Author:
Paolo Stegagno This class represents a ROS topic. Given a ROS node, it opens a Publisher, a Subscriber or both on a given topic. Before using this class, you need to initialize ROS and build a node.

Constructor & Destructor Documentation

template<class msg_type, typename msg_type_ptr>
MipBaselib::ROSiFace< msg_type, msg_type_ptr >::~ROSiFace (  ) 

Destructor.

This destructor deletes the ros::Publisher and/or ros::Subscriber.


Member Function Documentation

template<class msg_type, typename msg_type_ptr>
bool MipBaselib::ROSiFace< msg_type, msg_type_ptr >::sendMessage ( const msg_type &  message  ) 

Send message on topic.

Parameters:
[in] &message Message to send.
Returns:
true if ros::ok(), false otherwise. If this ROSiFace is ROSIFACE_W or ROSIFACE_RW, this method writes the "message" on the topic. If this ROSiFace is ROSIFACE_R, this method throw an exception and terminate the execution of the program.

template<class msg_type, typename msg_type_ptr>
bool MipBaselib::ROSiFace< msg_type, msg_type_ptr >::updateMessage (  )  [virtual]

Update message in topic.

Returns:
true if ros::ok(), false otherwise. If this ROSiFace is ROSIFACE_R or ROSIFACE_RW, this method updates the internal buffer with the messages received on the topic. If this ROSiFace is ROSIFACE_W, this method throws an exception and terminate the execution of the program.

Implements MipBaselib::ROSiFaceBoss.

template<class msg_type, typename msg_type_ptr>
bool MipBaselib::ROSiFace< msg_type, msg_type_ptr >::getMessage ( msg_type &  msg  ) 

Get message from topic.

Parameters:
[out] msg Variable where the message will be stored
Returns:
true if ros::ok(), false otherwise. If this ROSiFace is ROSIFACE_R or ROSIFACE_RW, this method writes in "msg" the last received message on the topic. If this ROSiFace is ROSIFACE_W, this method throw an exception and terminate the execution of the program.

template<class msg_type, typename msg_type_ptr>
void MipBaselib::ROSiFace< msg_type, msg_type_ptr >::getMsgList ( deque< msg_type > &  listMsg  ) 

Get the stored messages in the list.

Parameters:
[out] msg List where the messages will be stored If this ROSiFace is ROSIFACE_R or ROSIFACE_RW, this method writes in "listMsg" the list of received messages (max dimension is bufferDim). If this ROSiFace is ROSIFACE_W, this method throw an exception and terminate the execution of the program.


The documentation for this class was generated from the following file:

Generated on Mon Feb 20 07:01:11 2017 for MIP by  doxygen 1.5.6