Go to the documentation of this file.00001
00002
00003
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)