Files | Classes | Typedefs | Functions
Transport

Handles transportation of messages. More...

Files

file  TransportTypes.hh
 Forward declarations for transport.
 

Classes

class  gazebo::transport::CallbackHelper
 A helper class to handle callbacks when messages arrive. More...
 
class  gazebo::transport::CallbackHelperT< M >
 Callback helper Template. More...
 
class  gazebo::transport::Connection
 Single TCP/IP connection manager. More...
 
class  gazebo::transport::ConnectionManager
 Manager of connections. More...
 
class  gazebo::transport::IOManager
 Manages boost::asio IO. More...
 
class  gazebo::transport::Node
 A node can advertise and subscribe topics, publish on advertised topics and listen to subscribed topics. More...
 
class  gazebo::transport::Publication
 A publication for a topic. More...
 
class  gazebo::transport::PublicationTransport
 transport/transport.hh More...
 
class  gazebo::transport::Publisher
 A publisher of messages on a topic. More...
 
class  gazebo::transport::RawCallbackHelper
 Used to connect publishers to subscribers, where the subscriber wants the raw data from the publisher. More...
 
class  gazebo::transport::SubscribeOptions
 Options for a subscription. More...
 
class  gazebo::transport::Subscriber
 A subscriber to a topic. More...
 
class  gazebo::transport::SubscriptionTransport
 transport/transport.hh More...
 
class  gazebo::transport::TopicManager
 Manages topics and their subscriptions. More...
 

Typedefs

typedef boost::shared_ptr
< CallbackHelper > 
gazebo::transport::CallbackHelperPtr
 boost shared pointer to transport::CallbackHelper More...
 

Functions

GAZEBO_VISIBLE void gazebo::transport::clear_buffers ()
 Clear any remaining communication buffers. More...
 
GAZEBO_VISIBLE
transport::ConnectionPtr 
gazebo::transport::connectToMaster ()
 Create a connection to master. More...
 
GAZEBO_VISIBLE void gazebo::transport::fini ()
 Cleanup the transport component. More...
 
GAZEBO_VISIBLE 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. More...
 
GAZEBO_VISIBLE void gazebo::transport::get_topic_namespaces (std::list< std::string > &_namespaces)
 Return all the namespace (world names) on the master. More...
 
GAZEBO_VISIBLE std::map
< std::string, std::list
< std::string > > 
gazebo::transport::getAdvertisedTopics ()
 Get a list of all the topics and their message types. More...
 
GAZEBO_VISIBLE std::list
< std::string > 
gazebo::transport::getAdvertisedTopics (const std::string &_msgType)
 Get a list of all the unique advertised topic names. More...
 
GAZEBO_VISIBLE bool gazebo::transport::getMinimalComms ()
 Get whether minimal comms has been enabled. More...
 
GAZEBO_VISIBLE std::string gazebo::transport::getTopicMsgType (const std::string &_topicName)
 Get the message typename that is published on the given topic. More...
 
GAZEBO_VISIBLE bool gazebo::transport::init (const std::string &_masterHost="", unsigned int _masterPort=0, uint32_t _timeoutIterations=30)
 Initialize the transport system. More...
 
bool gazebo::transport::is_stopped ()
 Is the transport system stopped? More...
 
GAZEBO_VISIBLE void gazebo::transport::pause_incoming (bool _pause)
 Pause or unpause incoming messages. More...
 
template<typename M >
GAZEBO_VISIBLE void gazebo::transport::publish (const std::string &_topic, const google::protobuf::Message &_message)
 A convenience function for a one-time publication of a message. More...
 
GAZEBO_VISIBLE
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. More...
 
GAZEBO_VISIBLE 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. More...
 
GAZEBO_VISIBLE void gazebo::transport::requestNoReply (NodePtr _node, const std::string &_request, const std::string &_data="")
 Send a request and don't wait for a response. More...
 
GAZEBO_VISIBLE void gazebo::transport::run ()
 Run the transport component. More...
 
GAZEBO_VISIBLE void gazebo::transport::setMinimalComms (bool _enabled)
 Set whether minimal comms should be used. More...
 
GAZEBO_VISIBLE void gazebo::transport::stop ()
 Stop the transport component from running. More...
 
GAZEBO_VISIBLE bool gazebo::transport::waitForNamespaces (const gazebo::common::Time &_maxWait)
 Blocks while waiting for topic namespaces from the Master. More...
 

Detailed Description

Handles transportation of messages.

Remarks
Environment Variables:
  • GAZEBO_IP_WHITE_LIST: Comma separated list of valid IPs. Leave this empty to accept connections from all addresses.
  • GAZEBO_IP: IP address to export. This will override the default IP lookup.
  • GAZEBO_HOSTNAME: Hostame to export. Setting this will override both GAZEBO_IP and the default IP lookup.

Typedef Documentation

typedef boost::shared_ptr<CallbackHelper> gazebo::transport::CallbackHelperPtr

boost shared pointer to transport::CallbackHelper

Function Documentation

GAZEBO_VISIBLE void gazebo::transport::clear_buffers ( )

Clear any remaining communication buffers.

GAZEBO_VISIBLE transport::ConnectionPtr gazebo::transport::connectToMaster ( )

Create a connection to master.

Returns
Connection to the master, NULL on error.
GAZEBO_VISIBLE void gazebo::transport::fini ( )

Cleanup the transport component.

GAZEBO_VISIBLE 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.

Parameters
[out]_master_hostThe hostname of the master is set to this param
[out]_master_portThe port of the master is set to this param
Returns
true if GAZEBO_MASTER_URI was successfully parsed; false otherwise (in which case output params are not set)
GAZEBO_VISIBLE void gazebo::transport::get_topic_namespaces ( std::list< std::string > &  _namespaces)

Return all the namespace (world names) on the master.

Parameters
[out]_namespacesThe list of namespace will be written here
GAZEBO_VISIBLE std::map<std::string, std::list<std::string> > gazebo::transport::getAdvertisedTopics ( )

Get a list of all the topics and their message types.

Returns
A map where keys are message types, and values are a list of topic names.
GAZEBO_VISIBLE std::list<std::string> gazebo::transport::getAdvertisedTopics ( const std::string &  _msgType)

Get a list of all the unique advertised topic names.

Parameters
[in]_msgTypeType of message to filter the result on. If empty, then a list of all the topics is returned.
Returns
A list of the advertised topics that publish messages of the type specified by _msgType.
GAZEBO_VISIBLE bool gazebo::transport::getMinimalComms ( )

Get whether minimal comms has been enabled.

Returns
True if minimal comms is enabled.
GAZEBO_VISIBLE std::string gazebo::transport::getTopicMsgType ( const std::string &  _topicName)

Get the message typename that is published on the given topic.

Parameters
[in]_topicNameName of the topic to query.
Returns
The message type, or empty string if the topic is not valid.
GAZEBO_VISIBLE bool gazebo::transport::init ( const std::string &  _masterHost = "",
unsigned int  _masterPort = 0,
uint32_t  _timeoutIterations = 30 
)

Initialize the transport system.

Parameters
[in]_masterHostThe hostname or IP of the master. Leave empty to use pull address from the GAZEBO_MASTER_URI env var.
[in]_masterPortThe port of the master. Leave empty to use pull address from the GAZEBO_MASTER_URI env var.
[in]_timeoutIterationsNumber of times to wait for a connection to master.
Returns
true if initialization succeeded; false otherwise
GAZEBO_VISIBLE bool gazebo::transport::is_stopped ( )

Is the transport system stopped?

Returns
true if the transport system is stopped; false otherwise
GAZEBO_VISIBLE void gazebo::transport::pause_incoming ( bool  _pause)

Pause or unpause incoming messages.

When paused, messages are queued for later delivery

Parameters
[in]_pauseIf true, pause; otherwise unpause
template<typename M >
GAZEBO_VISIBLE 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.

Parameters
[in]_topicThe topic to advertise
[in]_messageMessage to be published
GAZEBO_VISIBLE 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.

Parameters
[in]_worldNameThe name of the world to which the request should be sent
[in]_requestThe type request.
[in]_dataOptional data string.
Returns
The response to the request. Can be empty.
GAZEBO_VISIBLE 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.

Parameters
[in]_worldNameThe name of the world to which the request should be sent.
[in]_requestThe type request.
[in]_dataOptional data string.
GAZEBO_VISIBLE 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.

Parameters
[in]_nodePointer to a node that provides communication.
[in]_requestThe type request.
[in]_dataOptional data string.
GAZEBO_VISIBLE 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

GAZEBO_VISIBLE void gazebo::transport::setMinimalComms ( bool  _enabled)

Set whether minimal comms should be used.

This will be used to reduce network traffic.

GAZEBO_VISIBLE void gazebo::transport::stop ( )

Stop the transport component from running.

GAZEBO_VISIBLE 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.

Returns
True if namespaces were found before _maxWait time.