module documentation

Undocumented

Class MsgContext Context object for storing MsgSpec instances and related metadata.
Exception MsgNotFound Undocumented
Function convert_constant_value Convert constant value declaration to python value. Does not do type-checking, so ValueError or other exceptions may be raised.
Function get_msg_file Determine the file system path for the specified .msg on search_path.
Function get_srv_file Determine the file system path for the specified .srv on path.
Function load_depends Compute dependencies of spec and load their MsgSpec dependencies into msg_context.
Function load_msg_by_type Load message specification for specified type.
Function load_msg_depends Add the list of message types that spec depends on to depends.
Function load_msg_from_file Convert the .msg representation in the file to a MsgSpec instance.
Function load_msg_from_string Load message specification from a string.
Function load_srv_by_type Load service specification for specified type.
Function load_srv_from_file Convert the .srv representation in the file to a SrvSpec instance.
Function load_srv_from_string Load SrvSpec from the .srv file.
Function _load_constant_line No summary
Function _load_field_line No summary
Function _strip_comments Undocumented
def convert_constant_value(field_type, val):

Convert constant value declaration to python value. Does not do type-checking, so ValueError or other exceptions may be raised.

Parameters
field_typeROS field type, str
valstring representation of constant, str
Raises
Unknown exceptionValueError If unable to convert to python representation
Unknown exceptionInvalidMsgSpec If value exceeds specified integer width
def get_msg_file(package, base_type, search_path, ext=EXT_MSG):

Determine the file system path for the specified .msg on search_path.

Parameters
packagename of package file is in, str
base_typetype name of message, e.g. 'Point2DFloat32', str
search_pathdictionary mapping message namespaces to a directory locations
extmsg file extension. Override with EXT_SRV to search for services instead.
Returns
filesystem path of requested file, str
Raises
Unknown exceptionMsgNotFound If message cannot be located.
def get_srv_file(package, base_type, search_path):

Determine the file system path for the specified .srv on path.

Parameters
packagename of package .srv file is in, str
base_typetype name of service, e.g. 'Empty', str
search_pathdictionary mapping message namespaces to a directory locations
Returns
file path of .srv file in specified package, str
Raises
Unknown exceptionMsgNotFound If service file cannot be located.
def load_depends(msg_context, spec, msg_search_path):

Compute dependencies of spec and load their MsgSpec dependencies into msg_context.

NOTE: msg_search_path is only for finding .msg files. .srv files have a separate and distinct search path. As services cannot depend on other services, it is not necessary to provide the srv search path here.

Parameters
msg_contextMsgContext instance to load dependencies into/from.
specMsgSpec or SrvSpec instance to load dependencies for.
msg_search_pathdictionary mapping message namespaces to a directory locations.
Raises
Unknown exceptionMsgNotFound If dependency cannot be located.
def load_msg_by_type(msg_context, msg_type, search_path):

Load message specification for specified type.

NOTE: this will register the message in the msg_context.

Parameters
msg_contextMsgContext for finding loaded dependencies
msg_typerelative or full message type.
search_pathdictionary mapping message namespaces to a directory locations
Returns
MsgSpec instance, (str, MsgSpec)
Raises
Unknown exceptionMsgNotFound If message cannot be located.
def load_msg_depends(msg_context, spec, search_path):

Add the list of message types that spec depends on to depends.

Parameters
msg_contextMsgContext instance to load dependencies into/from.
specmessage to compute dependencies for, MsgSpec/SrvSpec
search_pathdictionary mapping message namespaces to a directory locations
depsfor recursion use only, do not set
Returns
list of dependency names, [str]
Raises
Unknown exceptionMsgNotFound If dependency cannot be located.
def load_msg_from_file(msg_context, file_path, full_name):

Convert the .msg representation in the file to a MsgSpec instance.

NOTE: this will register the message in the msg_context.

Parameters
msg_contextUndocumented
file_pathpath of file to load from, str
full_nameUndocumented
Returns
MsgSpec instance
Raises
Unknown exceptionInvalidMsgSpec: if syntax errors or other problems are detected in file
def load_msg_from_string(msg_context, text, full_name):

Load message specification from a string.

NOTE: this will register the message in the msg_context.

Parameters
msg_contextMsgContext for finding loaded dependencies
text.msg text , str
full_nameUndocumented
Returns
MsgSpec specification
Raises
Unknown exceptionInvalidMsgSpec If syntax errors or other problems are detected in file
def load_srv_by_type(msg_context, srv_type, search_path):

Load service specification for specified type.

NOTE: services are never registered in a MsgContext.

Parameters
msg_contextMsgContext for finding loaded dependencies
srv_typerelative or full message type.
search_pathdictionary mapping message namespaces to a directory locations
Returns
MsgSpec instance, (str, MsgSpec)
Raises
Unknown exceptionMsgNotFound If message cannot be located.
def load_srv_from_file(msg_context, file_path, full_name):

Convert the .srv representation in the file to a SrvSpec instance.

Parameters
msg_contextMsgContext instance to load request/response messages into.
file_pathUndocumented
full_nameUndocumented
file_namename of file to load from, str
Returns
SrvSpec instance
Raises
Unknown exceptionInvalidMsgSpec If syntax errors or other problems are detected in file
def load_srv_from_string(msg_context, text, full_name):

Load SrvSpec from the .srv file.

:raises InvalidMsgSpec If syntax errors or other problems are detected in file

Parameters
msg_contextMsgContext instance to load request/response messages into.
text.msg text , str
full_nameUndocumented
package_namecontext to use for msg type name, i.e. the package name, or '' to use local naming convention. str
Returns
SrvSpec instance
def _load_constant_line(orig_line):
Raises
Unknown exceptionInvalidMsgSpec
def _load_field_line(orig_line, package_context):
Returns
(field_type, name) tuple, (str, str)
Raises
Unknown exceptionInvalidMsgSpec
def _strip_comments(line):

Undocumented