wrapper.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 # Base class for Python bindings to C++ class with ROS messages, Python part
00003 # of the binding.
00004 
00005 from StringIO import StringIO
00006 
00007 
00008 class WrapperPy(object):
00009     def _to_cpp(self, msg):
00010         """Return a serialized string from a ROS message
00011 
00012         Parameters
00013         ----------
00014         - msg: a ROS message instance.
00015         """
00016         buf = StringIO()
00017         msg.serialize(buf)
00018         return buf.getvalue()
00019 
00020     def _from_cpp(self, str_msg, cls):
00021         """Return a ROS message from a serialized string
00022 
00023         Parameters
00024         ----------
00025         - str_msg: str, serialized message
00026         - cls: ROS message class, e.g. sensor_msgs.msg.LaserScan.
00027         """
00028         msg = cls()
00029         return msg.deserialize(str_msg)


crossing_detector
Author(s): Gaël Ecorchard , Karel Košnar , Vojtěch Vonásek
autogenerated on Thu Jun 6 2019 22:02:06