Package rostopic

Package rostopic

source code

Classes
  ROSTopicException
Base exception class of rostopic-related errors
  ROSTopicIOException
rostopic errors related to network I/O failures
  ROSTopicHz
ROSTopicHz receives messages for a topic and computes frequency stats
  ROSTopicBandwidth
  CallbackEcho
Callback instance that can print callback data in a variety of formats.
Functions
 
msgevalgen(pattern)
Generates a function that returns the relevant field (aka 'subtopic') of a Message object :param pattern: subtopic, e.g.
source code
 
get_topic_type(topic, blocking=False)
Get the topic type.
source code
 
get_topic_class(topic, blocking=False)
Get the topic message class :returns: message class for topic, real topic name, and function for evaluating message objects into the subtopic (or ``None``).
source code
 
get_api(master, caller_id)
Get XML-RPC API of node :param master: XML-RPC handle to ROS Master, :class:`xmlrpclib.ServerProxy` :param caller_id: node name, ``str`` :returns: XML-RPC URI of node, ``str`` :raises: :exc:`ROSTopicIOException` If unable to communicate with master
source code
 
get_info_text(topic)
Get human-readable topic description
source code
 
create_field_filter(echo_nostr, echo_noarr) source code
 
find_by_type(topic_type)
Lookup topics by topic_type :param topic_type: type of topic to find, ``str`` :returns: list of topic names that use topic_type, ``[str]``
source code
 
create_publisher(topic_name, topic_type, latch)
Create rospy.Publisher instance from the string topic name and type.
source code
 
publish_message(pub, msg_class, pub_args, rate=None, once=False, verbose=False)
Create new instance of msg_class, populate with pub_args, and publish.
source code
 
file_yaml_arg(filename)
:param filename: file name, ``str`` :returns: Iterator that yields pub args (list of args), ``iterator`` :raises: :exc:`ROSTopicException` If filename is invalid
source code
 
argv_publish(pub, msg_class, pub_args, rate, once, verbose) source code
 
wait_for_subscriber(pub, timeout) source code
 
param_publish_once(pub, msg_class, param_name, verbose) source code
 
param_publish(pub, msg_class, param_name, rate, verbose)
:param param_name: ROS parameter name, ``str`` :returns: List of msg dicts in file, ``[{str: any}]`` :raises: :exc:`ROSTopicException` If parameter is not set
source code
 
stdin_publish(pub, msg_class, rate, once, filename, verbose)
:param filename: name of file to read from instead of stdin, or ``None``, ``str``
source code
 
stdin_yaml_arg()
Iterate over YAML documents in stdin :returns: for next list of arguments on stdin.
source code
 
rostopicmain(argv=None) source code
Variables
  NAME = 'rostopic'
  SUBSCRIBER_TIMEOUT = 5.0
  __package__ = 'rostopic'
Function Details

msgevalgen(pattern)

source code 

Generates a function that returns the relevant field (aka 'subtopic') of a Message object :param pattern: subtopic, e.g. /x. Must have a leading '/' if specified, ``str`` :returns: function that converts a message into the desired value, ``fn(Message) -> value``

get_topic_type(topic, blocking=False)

source code 

Get the topic type.

:param topic: topic name, ``str``
:param blocking: (default False) block until topic becomes available, ``bool``

:returns: topic type, real topic name and fn to evaluate the message instance
  if the topic points to a field within a topic, e.g. /rosout/msg. fn is None otherwise. ``(str, str, fn)``
:raises: :exc:`ROSTopicException` If master cannot be contacted

get_topic_class(topic, blocking=False)

source code 

Get the topic message class
:returns: message class for topic, real topic
  name, and function for evaluating message objects into the subtopic
  (or ``None``). ``(Message, str, str)``
:raises: :exc:`ROSTopicException` If topic type cannot be determined or loaded

get_info_text(topic)

source code 

Get human-readable topic description

:param topic: topic name, ``str``

create_publisher(topic_name, topic_type, latch)

source code 

Create rospy.Publisher instance from the string topic name and type. This is a powerful method as it allows creation of rospy.Publisher and Message instances using the topic and type names. This enables more dynamic publishing from Python programs.

:param topic_name: name of topic, ``str`` :param topic_type: name of topic type, ``str`` :param latch: latching topic, ``bool`` :returns: topic :class:`rospy.Publisher`, :class:`Message` class

publish_message(pub, msg_class, pub_args, rate=None, once=False, verbose=False)

source code 

Create new instance of msg_class, populate with pub_args, and publish. This may print output to screen.

:param pub: :class:`rospy.Publisher` instance for topic :param msg_class: Message type, ``Class`` :param pub_args: Arguments to initialize message that is published, ``[val]`` :param rate: publishing rate (hz) or None for just once, ``int`` :param once: publish only once and return, ``bool`` :param verbose: If ``True``, print more verbose output to stdout, ``bool``

stdin_yaml_arg()

source code 

Iterate over YAML documents in stdin :returns: for next list of arguments on stdin. Iterator returns a list of args for each call, ``iterator``