Go to the documentation of this file.00001 """autogenerated by genpy from cogman_msgs/PtuResult.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class PtuResult(genpy.Message):
00009 _md5sum = "d7e708f879c94bb931716d8f4f130f30"
00010 _type = "cogman_msgs/PtuResult"
00011 _has_header = False
00012 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 #result
00014 string answer
00015
00016 """
00017 __slots__ = ['answer']
00018 _slot_types = ['string']
00019
00020 def __init__(self, *args, **kwds):
00021 """
00022 Constructor. Any message fields that are implicitly/explicitly
00023 set to None will be assigned a default value. The recommend
00024 use is keyword arguments as this is more robust to future message
00025 changes. You cannot mix in-order arguments and keyword arguments.
00026
00027 The available fields are:
00028 answer
00029
00030 :param args: complete set of field values, in .msg order
00031 :param kwds: use keyword arguments corresponding to message field names
00032 to set specific fields.
00033 """
00034 if args or kwds:
00035 super(PtuResult, self).__init__(*args, **kwds)
00036
00037 if self.answer is None:
00038 self.answer = ''
00039 else:
00040 self.answer = ''
00041
00042 def _get_types(self):
00043 """
00044 internal API method
00045 """
00046 return self._slot_types
00047
00048 def serialize(self, buff):
00049 """
00050 serialize message into buffer
00051 :param buff: buffer, ``StringIO``
00052 """
00053 try:
00054 _x = self.answer
00055 length = len(_x)
00056 if python3 or type(_x) == unicode:
00057 _x = _x.encode('utf-8')
00058 length = len(_x)
00059 buff.write(struct.pack('<I%ss'%length, length, _x))
00060 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00061 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00062
00063 def deserialize(self, str):
00064 """
00065 unpack serialized message in str into this message instance
00066 :param str: byte array of serialized message, ``str``
00067 """
00068 try:
00069 end = 0
00070 start = end
00071 end += 4
00072 (length,) = _struct_I.unpack(str[start:end])
00073 start = end
00074 end += length
00075 if python3:
00076 self.answer = str[start:end].decode('utf-8')
00077 else:
00078 self.answer = str[start:end]
00079 return self
00080 except struct.error as e:
00081 raise genpy.DeserializationError(e)
00082
00083
00084 def serialize_numpy(self, buff, numpy):
00085 """
00086 serialize message with numpy array types into buffer
00087 :param buff: buffer, ``StringIO``
00088 :param numpy: numpy python module
00089 """
00090 try:
00091 _x = self.answer
00092 length = len(_x)
00093 if python3 or type(_x) == unicode:
00094 _x = _x.encode('utf-8')
00095 length = len(_x)
00096 buff.write(struct.pack('<I%ss'%length, length, _x))
00097 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00098 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00099
00100 def deserialize_numpy(self, str, numpy):
00101 """
00102 unpack serialized message in str into this message instance using numpy for array types
00103 :param str: byte array of serialized message, ``str``
00104 :param numpy: numpy python module
00105 """
00106 try:
00107 end = 0
00108 start = end
00109 end += 4
00110 (length,) = _struct_I.unpack(str[start:end])
00111 start = end
00112 end += length
00113 if python3:
00114 self.answer = str[start:end].decode('utf-8')
00115 else:
00116 self.answer = str[start:end]
00117 return self
00118 except struct.error as e:
00119 raise genpy.DeserializationError(e)
00120
00121 _struct_I = genpy.struct_I