Package rosmsg
[frames] | no frames]

Package rosmsg

source code

Implements rosmsg/rossrv command-line tools.

The code API of the rosmsg module is unstable.

Classes
  ROSMsgException
  RosMsgProtoException
  RosMsgProtoArgsException
Functions
 
construct_ordered_mapping(self, node, deep=False) source code
 
construct_yaml_map_with_ordered_dict(self, node) source code
 
represent_ordered_mapping(self, tag, mapping, flow_style=None) source code
 
get_array_type_instance(field_type, default_package=None)
returns a single instance of field_type, where field_type can be a message or ros primitive or an flexible size array.
source code
 
get_yaml_for_msg(msg, prefix='', time_offset=None, current_time=None, field_filter=None, flow_style_=None, fill_arrays_=False)
Builds a YAML string of message.
source code
 
create_names_filter(names)
returns a function to use as filter that returns all objects slots except those with names in list.
source code
 
init_rosmsg_proto() source code
 
rosmsg_cmd_prototype(args) source code
 
spec_to_str(msg_context, spec, buff=None, indent='')
Convert spec into a string representation.
source code
 
get_srv_text(type_, raw=False, rospack=None)
Get .srv file for type_ as text :param type_: service type, ``str`` :param raw: if True, include comments and whitespace (default False), ``bool`` :returns: text of .srv file, ``str``
source code
 
get_msg_text(type_, raw=False, rospack=None)
Get .msg file for type_ as text :param type_: message type, ``str`` :param raw: if True, include comments and whitespace (default False), ``bool`` :returns: text of .msg file, ``str`` :raises :exc:`ROSMsgException` If type_ is unknown
source code
 
rosmsg_debug(rospack, mode, type_, raw=False)
Prints contents of msg/srv file :param mode: MODE_MSG or MODE_SRV, ``str``
source code
 
list_srvs(package, rospack=None)
List srvs contained in package :param package: package name, ``str`` :param rospack: an optional rospack instance to be reused, ``rospkg.RosPack`` :returns: list of srvs in package, ``[str]``
source code
 
list_msgs(package, rospack=None)
List msgs contained in package :param package: package name, ``str`` :param rospack: an optional rospack instance to be reused, ``rospkg.RosPack`` :returns: list of msgs in package, ``[str]``
source code
 
list_types(package, mode='.msg', rospack=None)
Lists msg/srvs contained in package :param package: package name, ``str`` :param mode: MODE_MSG or MODE_SRV.
source code
 
iterate_packages(rospack, mode)
Iterator for packages that contain messages/services :param mode: .msg or .srv, ``str``
source code
 
rosmsg_search(rospack, mode, base_type)
Iterator for all packages that contain a message matching base_type
source code
 
rosmsg_cmd_show(mode, full) source code
 
rosmsg_md5(mode, type_) source code
 
rosmsg_cmd_md5(mode, full) source code
 
rosmsg_cmd_package(mode, full) source code
 
rosmsg_cmd_packages(mode, full, argv=None) source code
 
rosmsg_cmd_list(mode, full, argv=None) source code
 
fullusage(mode)
:param cmd: command name, ``str`` :returns: usage text for cmd, ``str``
source code
 
rosmsgmain(mode='.msg')
Main entry point for command-line tools (rosmsg/rossrv).
source code
Variables
  MODE_MSG = '.msg'
  MODE_SRV = '.srv'
  MAX_DEFAULT_NON_FLOW_ITEMS = 4
  __package__ = 'rosmsg'
Function Details

get_yaml_for_msg(msg, prefix='', time_offset=None, current_time=None, field_filter=None, flow_style_=None, fill_arrays_=False)

source code 

Builds a YAML string of message.

Parameters:
  • msg - A object, dict or array
  • flow_style_ (bool) - if True, produces one line with brackets, if false uses multiple lines with indentation, if None uses both using heuristics
  • prefix - prefixes all lines with this string
  • fill_arrays_ - if True, for all flexible size arrays an element will be generated
  • current_time (Time) - currently not used. Only provided for API compatibility. current_time passes in the current time with respect to the message.
  • field_filter (fn(Message)->iter(str)) - filter the fields that are strified for Messages.
Returns:
a string

spec_to_str(msg_context, spec, buff=None, indent='')

source code 

Convert spec into a string representation. Helper routine for MsgSpec. :param indent: internal use only, ``str`` :param buff: internal use only, ``StringIO`` :returns: string representation of spec, ``str``

get_srv_text(type_, raw=False, rospack=None)

source code 

Get .srv file for type_ as text :param type_: service type, ``str`` :param raw: if True, include comments and whitespace (default False), ``bool`` :returns: text of .srv file, ``str``

Raises:

list_types(package, mode='.msg', rospack=None)

source code 

Lists msg/srvs contained in package :param package: package name, ``str`` :param mode: MODE_MSG or MODE_SRV. Defaults to msgs, ``str`` :param rospack: an optional rospack instance to be reused, ``rospkg.RosPack`` :returns: list of msgs/srv in package, ``[str]``

rosmsg_search(rospack, mode, base_type)

source code 

Iterator for all packages that contain a message matching base_type

:param base_type: message base type to match, e.g. 'String' would match std_msgs/String, ``str``

rosmsgmain(mode='.msg')

source code 

Main entry point for command-line tools (rosmsg/rossrv).

rosmsg can interact with either ros messages or ros services. The mode param indicates which :param mode: MODE_MSG or MODE_SRV, ``str``