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