Handles transportation of messages. More...
Files | |
file | TransportTypes.hh |
Forward declarations for transport. | |
Classes | |
class | CallbackHelper |
A helper class to handle callbacks when messages arrive. More... | |
class | CallbackHelperT< M > |
Callback helper Template. More... | |
class | Connection |
Single TCP/IP connection manager. More... | |
class | ConnectionManager |
Manager of connections. More... | |
class | IOManager |
Manages boost::asio IO. More... | |
class | Node |
A node can advertise and subscribe topics, publish on advertised topics and listen to subscribed topics. More... | |
class | Publication |
A publication for a topic. More... | |
class | PublicationTransport |
transport/transport.hh More... | |
class | Publisher |
A publisher of messages on a topic. More... | |
class | RawCallbackHelper |
Used to connect publishers to subscribers, where the subscriber wants the raw data from the publisher. More... | |
class | SubscribeOptions |
Options for a subscription. More... | |
class | Subscriber |
A subscriber to a topic. More... | |
class | SubscriptionTransport |
transport/transport.hh More... | |
class | TopicManager |
Manages topics and their subscriptions. More... | |
Typedefs | |
typedef boost::shared_ptr < CallbackHelper > | CallbackHelperPtr |
boost shared pointer to transport::CallbackHelper More... | |
Functions | |
void | clear_buffers () |
Clear any remaining communication buffers. More... | |
transport::ConnectionPtr | connectToMaster () |
Create a connection to master. More... | |
void | fini () |
Cleanup the transport component. More... | |
bool | get_master_uri (std::string &_master_host, unsigned int &_master_port) |
Get the hostname and port of the master from the GAZEBO_MASTER_URI environment variable. More... | |
void | get_topic_namespaces (std::list< std::string > &_namespaces) |
Return all the namespace (world names) on the master. More... | |
std::map< std::string, std::list< std::string > > | getAdvertisedTopics () |
Get a list of all the topics and their message types. More... | |
std::list< std::string > | getAdvertisedTopics (const std::string &_msgType) |
Get a list of all the unique advertised topic names. More... | |
bool | getMinimalComms () |
Get whether minimal comms has been enabled. More... | |
std::string | getTopicMsgType (const std::string &_topicName) |
Get the message typename that is published on the given topic. More... | |
bool | init (const std::string &_masterHost="", unsigned int _masterPort=0, uint32_t _timeoutIterations=30) |
Initialize the transport system. More... | |
bool | is_stopped () |
Is the transport system stopped? More... | |
void | pause_incoming (bool _pause) |
Pause or unpause incoming messages. More... | |
template<typename M > | |
void | publish (const std::string &_topic, const google::protobuf::Message &_message) |
A convenience function for a one-time publication of a message. More... | |
boost::shared_ptr< msgs::Response > | request (const std::string &_worldName, const std::string &_request, const std::string &_data="") |
Send a request and receive a response. More... | |
void | requestNoReply (const std::string &_worldName, const std::string &_request, const std::string &_data="") |
Send a request and don't wait for a response. More... | |
void | requestNoReply (NodePtr _node, const std::string &_request, const std::string &_data="") |
Send a request and don't wait for a response. More... | |
void | run () |
Run the transport component. More... | |
void | setMinimalComms (bool _enabled) |
Set whether minimal comms should be used. More... | |
void | stop () |
Stop the transport component from running. More... | |
bool | waitForNamespaces (const gazebo::common::Time &_maxWait) |
Blocks while waiting for topic namespaces from the Master. More... | |
Handles transportation of messages.
typedef boost::shared_ptr<CallbackHelper> CallbackHelperPtr |
boost shared pointer to transport::CallbackHelper
void gazebo::transport::clear_buffers | ( | ) |
Clear any remaining communication buffers.
transport::ConnectionPtr gazebo::transport::connectToMaster | ( | ) |
Create a connection to master.
void gazebo::transport::fini | ( | ) |
Cleanup the transport component.
bool gazebo::transport::get_master_uri | ( | std::string & | _master_host, |
unsigned int & | _master_port | ||
) |
Get the hostname and port of the master from the GAZEBO_MASTER_URI environment variable.
[out] | _master_host | The hostname of the master is set to this param |
[out] | _master_port | The port of the master is set to this param |
void gazebo::transport::get_topic_namespaces | ( | std::list< std::string > & | _namespaces | ) |
Return all the namespace (world names) on the master.
[out] | _namespaces | The list of namespace will be written here |
std::map<std::string, std::list<std::string> > gazebo::transport::getAdvertisedTopics | ( | ) |
Get a list of all the topics and their message types.
std::list<std::string> gazebo::transport::getAdvertisedTopics | ( | const std::string & | _msgType | ) |
Get a list of all the unique advertised topic names.
[in] | _msgType | Type of message to filter the result on. If empty, then a list of all the topics is returned. |
bool gazebo::transport::getMinimalComms | ( | ) |
Get whether minimal comms has been enabled.
std::string gazebo::transport::getTopicMsgType | ( | const std::string & | _topicName | ) |
Get the message typename that is published on the given topic.
[in] | _topicName | Name of the topic to query. |
bool gazebo::transport::init | ( | const std::string & | _masterHost = "" , |
unsigned int | _masterPort = 0 , |
||
uint32_t | _timeoutIterations = 30 |
||
) |
Initialize the transport system.
[in] | _masterHost | The hostname or IP of the master. Leave empty to use pull address from the GAZEBO_MASTER_URI env var. |
[in] | _masterPort | The port of the master. Leave empty to use pull address from the GAZEBO_MASTER_URI env var. |
[in] | _timeoutIterations | Number of times to wait for a connection to master. |
bool is_stopped | ( | ) |
Is the transport system stopped?
void gazebo::transport::pause_incoming | ( | bool | _pause | ) |
Pause or unpause incoming messages.
When paused, messages are queued for later delivery
[in] | _pause | If true, pause; otherwise unpause |
void gazebo::transport::publish | ( | const std::string & | _topic, |
const google::protobuf::Message & | _message | ||
) |
A convenience function for a one-time publication of a message.
This is inefficient, compared to Node::Advertise followed by Publisher::Publish. This function should only be used when sending a message very infrequently.
[in] | _topic | The topic to advertise |
[in] | _message | Message to be published |
boost::shared_ptr<msgs::Response> gazebo::transport::request | ( | const std::string & | _worldName, |
const std::string & | _request, | ||
const std::string & | _data = "" |
||
) |
Send a request and receive a response.
This call will block until a response is received.
[in] | _worldName | The name of the world to which the request should be sent |
[in] | _request | The type request. |
[in] | _data | Optional data string. |
void gazebo::transport::requestNoReply | ( | const std::string & | _worldName, |
const std::string & | _request, | ||
const std::string & | _data = "" |
||
) |
Send a request and don't wait for a response.
This is non-blocking.
[in] | _worldName | The name of the world to which the request should be sent. |
[in] | _request | The type request. |
[in] | _data | Optional data string. |
void gazebo::transport::requestNoReply | ( | NodePtr | _node, |
const std::string & | _request, | ||
const std::string & | _data = "" |
||
) |
Send a request and don't wait for a response.
This is non-blocking.
[in] | _node | Pointer to a node that provides communication. |
[in] | _request | The type request. |
[in] | _data | Optional data string. |
void gazebo::transport::run | ( | ) |
Run the transport component.
Creates a thread to handle message passing. This call will block until the master can be contacted or until a retry limit is reached
void gazebo::transport::setMinimalComms | ( | bool | _enabled | ) |
Set whether minimal comms should be used.
This will be used to reduce network traffic.
void gazebo::transport::stop | ( | ) |
Stop the transport component from running.
bool gazebo::transport::waitForNamespaces | ( | const gazebo::common::Time & | _maxWait | ) |
Blocks while waiting for topic namespaces from the Master.
This function will wait a maximum of _maxWait.