Classes | |
class | DeserializationError |
class | Message |
class | MessageException |
class | SerializationError |
Functions | |
def | _convert_getattr |
def | _fill_message_args |
def | _fill_val |
def | _get_message_or_service_class |
def | check_type |
def | fill_message_args |
def | get_message_class |
def | get_printable_message_args |
def | get_service_class |
def | isstring |
def | strify_message |
Variables | |
dictionary | _message_class_cache = {} |
cache for get_message_class | |
dictionary | _service_class_cache = {} |
cache for get_service_class | |
dictionary | _widths |
long = int | |
tuple | struct_I = struct.Struct('<I') |
def include.genpy.message._convert_getattr | ( | val, | |
f, | |||
t | |||
) | [private] |
Convert atttribute types on the fly, if necessary. This is mainly to convert uint8[] fields back to an array type.
Definition at line 163 of file message.py.
def include.genpy.message._fill_message_args | ( | msg, | |
msg_args, | |||
keys, | |||
prefix = '' |
|||
) | [private] |
Populate message with specified args. :param msg: message to fill, ``Message`` :param msg_args: list of arguments to set fields to, ``[args]`` :param keys: keys to use as substitute values for messages and timestamps. ``dict`` :param prefix: field name prefix (for verbose printing), ``str`` :returns: unused/leftover message arguments. ``[args]`` :raise :exc:`MessageException` If not enough message arguments to fill message :raises: :exc:`ValueError` If msg or msg_args is not of correct type
Definition at line 467 of file message.py.
def include.genpy.message._fill_val | ( | msg, | |
f, | |||
v, | |||
keys, | |||
prefix | |||
) | [private] |
Subroutine of L{_fill_message_args()}. Sets a particular field on a message :param f: field name, ``str`` :param v: field value :param keys: keys to use as substitute values for messages and timestamps, ``dict`` :raises: exc:`MessageException`
Definition at line 396 of file message.py.
def include.genpy.message._get_message_or_service_class | ( | type_str, | |
message_type, | |||
reload_on_error = False |
|||
) | [private] |
Utility for retrieving message/service class instances. Used by get_message_class and get_service_class. :param type_str: 'msg' or 'srv', ``str`` :param message_type: type name of message/service, ``str`` :returns: Message/Service for message/service type or None, ``class`` :raises: :exc:`ValueError` If message_type is invalidly specified
Definition at line 547 of file message.py.
def include.genpy.message.check_type | ( | field_name, | |
field_type, | |||
field_val | |||
) |
Dynamic type checker that maps ROS .msg types to python types and verifies the python value. check_type() is not designed to be fast and is targeted at error diagnosis. This type checker is not designed to run fast and is meant only for error diagnosis. :param field_name: ROS .msg field name, ``str`` :param field_type: ROS .msg field type, ``str`` :param field_val: field value, ``Any`` :raises: :exc:`SerializationError` If typecheck fails
Definition at line 187 of file message.py.
def include.genpy.message.fill_message_args | ( | msg, | |
msg_args, | |||
keys = {} |
|||
) |
Populate message with specified args. Args are assumed to be a list of arguments from a command-line YAML parser. See http://www.ros.org/wiki/ROS/YAMLCommandLine for specification on how messages are filled. fill_message_args also takes in an optional 'keys' dictionary which contain substitute values for message and time types. These values must be of the correct instance type, i.e. a Message, Time, or Duration. In a string key is encountered with these types, the value from the keys dictionary will be used instead. This is mainly used to provide values for the 'now' timestamp. :param msg: message to fill, ``Message`` :param msg_args: list of arguments to set fields to, or If None, msg_args will be made an empty list., ``[args]`` :param keys: keys to use as substitute values for messages and timestamps, ``dict`` :raises: :exc:`MessageException` If not enough/too many message arguments to fill message
Definition at line 507 of file message.py.
def include.genpy.message.get_message_class | ( | message_type, | |
reload_on_error = False |
|||
) |
Get the message class. NOTE: this function maintains a local cache of results to improve performance. :param message_type: type name of message, ``str`` :param reload_on_error: (optional). Attempt to reload the Python module if unable to load message the first time. Defaults to False. This is necessary if messages are built after the first load. :returns: Message class for message/service type, ``Message class`` :raises :exc:`ValueError`: if message_type is invalidly specified
Definition at line 606 of file message.py.
def include.genpy.message.get_printable_message_args | ( | msg, | |
buff = None , |
|||
prefix = '' |
|||
) |
Get string representation of msg arguments :param msg: msg message to fill, ``Message`` :param prefix: field name prefix (for verbose printing), ``str`` :returns: printable representation of msg args, ``str``
Definition at line 370 of file message.py.
def include.genpy.message.get_service_class | ( | service_type, | |
reload_on_error = False |
|||
) |
Get the service class. NOTE: this function maintains a local cache of results to improve performance. :param service_type: type name of service, ``str`` :param reload_on_error: (optional). Attempt to reload the Python module if unable to load message the first time. Defaults to False. This is necessary if messages are built after the first load. :returns: Service class for service type, ``Service class`` :raises :exc:`Exception` If service_type is invalidly specified
Definition at line 627 of file message.py.
def include.genpy.message.isstring | ( | s | ) |
Small helper version to check an object is a string in a way that works for both Python 2 and 3
Definition at line 59 of file message.py.
def include.genpy.message.strify_message | ( | val, | |
indent = '' , |
|||
time_offset = None , |
|||
current_time = None , |
|||
field_filter = None , |
|||
fixed_numeric_width = None |
|||
) |
Convert value to string representation :param val: to convert to string representation. Most likely a Message. ``Value`` :param indent: indentation. If indent is set, then the return value will have a leading \n, ``str`` :param time_offset: if not None, time fields will be displayed as deltas from time_offset, ``Time`` :param current_time: currently not used. Only provided for API compatibility. current_time passes in the current time with respect to the message, ``Time`` :param field_filter: filter the fields that are strified for Messages, ``fn(Message)->iter(str)`` :returns: string (YAML) representation of message, ``str``
Definition at line 84 of file message.py.
dictionary include::genpy::message::_message_class_cache = {} |
cache for get_message_class
Definition at line 604 of file message.py.
dictionary include::genpy::message::_service_class_cache = {} |
cache for get_service_class
Definition at line 625 of file message.py.
dictionary include::genpy::message::_widths |
00001 { 00002 'byte': 8, 'char': 8, 'int8': 8, 'uint8': 8, 00003 'int16': 16, 'uint16': 16, 00004 'int32': 32, 'uint32': 32, 00005 'int64': 64, 'uint64': 64, 00006 }
Definition at line 180 of file message.py.
Definition at line 55 of file message.py.
tuple include::genpy::message::struct_I = struct.Struct('<I') |
Definition at line 57 of file message.py.