00001 """autogenerated by genpy from srs_object_database_msgs/grasp.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 grasp(genpy.Message):
00009 _md5sum = "cbd3885e5b559dd3c0fbffd8fcb36583"
00010 _type = "srs_object_database_msgs/grasp"
00011 _has_header = False
00012 _full_text = """int32 objectId
00013 string Objecttype
00014 string pose
00015 string fileDescription
00016 uint8[] bs
00017 int32 size
00018
00019 """
00020 __slots__ = ['objectId','Objecttype','pose','fileDescription','bs','size']
00021 _slot_types = ['int32','string','string','string','uint8[]','int32']
00022
00023 def __init__(self, *args, **kwds):
00024 """
00025 Constructor. Any message fields that are implicitly/explicitly
00026 set to None will be assigned a default value. The recommend
00027 use is keyword arguments as this is more robust to future message
00028 changes. You cannot mix in-order arguments and keyword arguments.
00029
00030 The available fields are:
00031 objectId,Objecttype,pose,fileDescription,bs,size
00032
00033 :param args: complete set of field values, in .msg order
00034 :param kwds: use keyword arguments corresponding to message field names
00035 to set specific fields.
00036 """
00037 if args or kwds:
00038 super(grasp, self).__init__(*args, **kwds)
00039
00040 if self.objectId is None:
00041 self.objectId = 0
00042 if self.Objecttype is None:
00043 self.Objecttype = ''
00044 if self.pose is None:
00045 self.pose = ''
00046 if self.fileDescription is None:
00047 self.fileDescription = ''
00048 if self.bs is None:
00049 self.bs = ''
00050 if self.size is None:
00051 self.size = 0
00052 else:
00053 self.objectId = 0
00054 self.Objecttype = ''
00055 self.pose = ''
00056 self.fileDescription = ''
00057 self.bs = ''
00058 self.size = 0
00059
00060 def _get_types(self):
00061 """
00062 internal API method
00063 """
00064 return self._slot_types
00065
00066 def serialize(self, buff):
00067 """
00068 serialize message into buffer
00069 :param buff: buffer, ``StringIO``
00070 """
00071 try:
00072 buff.write(_struct_i.pack(self.objectId))
00073 _x = self.Objecttype
00074 length = len(_x)
00075 if python3 or type(_x) == unicode:
00076 _x = _x.encode('utf-8')
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 _x = self.pose
00080 length = len(_x)
00081 if python3 or type(_x) == unicode:
00082 _x = _x.encode('utf-8')
00083 length = len(_x)
00084 buff.write(struct.pack('<I%ss'%length, length, _x))
00085 _x = self.fileDescription
00086 length = len(_x)
00087 if python3 or type(_x) == unicode:
00088 _x = _x.encode('utf-8')
00089 length = len(_x)
00090 buff.write(struct.pack('<I%ss'%length, length, _x))
00091 _x = self.bs
00092 length = len(_x)
00093
00094 if type(_x) in [list, tuple]:
00095 buff.write(struct.pack('<I%sB'%length, length, *_x))
00096 else:
00097 buff.write(struct.pack('<I%ss'%length, length, _x))
00098 buff.write(_struct_i.pack(self.size))
00099 except struct.error as se: self._check_types(se)
00100 except TypeError as te: self._check_types(te)
00101
00102 def deserialize(self, str):
00103 """
00104 unpack serialized message in str into this message instance
00105 :param str: byte array of serialized message, ``str``
00106 """
00107 try:
00108 end = 0
00109 start = end
00110 end += 4
00111 (self.objectId,) = _struct_i.unpack(str[start:end])
00112 start = end
00113 end += 4
00114 (length,) = _struct_I.unpack(str[start:end])
00115 start = end
00116 end += length
00117 if python3:
00118 self.Objecttype = str[start:end].decode('utf-8')
00119 else:
00120 self.Objecttype = str[start:end]
00121 start = end
00122 end += 4
00123 (length,) = _struct_I.unpack(str[start:end])
00124 start = end
00125 end += length
00126 if python3:
00127 self.pose = str[start:end].decode('utf-8')
00128 else:
00129 self.pose = str[start:end]
00130 start = end
00131 end += 4
00132 (length,) = _struct_I.unpack(str[start:end])
00133 start = end
00134 end += length
00135 if python3:
00136 self.fileDescription = str[start:end].decode('utf-8')
00137 else:
00138 self.fileDescription = str[start:end]
00139 start = end
00140 end += 4
00141 (length,) = _struct_I.unpack(str[start:end])
00142 start = end
00143 end += length
00144 if python3:
00145 self.bs = str[start:end].decode('utf-8')
00146 else:
00147 self.bs = str[start:end]
00148 start = end
00149 end += 4
00150 (self.size,) = _struct_i.unpack(str[start:end])
00151 return self
00152 except struct.error as e:
00153 raise genpy.DeserializationError(e)
00154
00155
00156 def serialize_numpy(self, buff, numpy):
00157 """
00158 serialize message with numpy array types into buffer
00159 :param buff: buffer, ``StringIO``
00160 :param numpy: numpy python module
00161 """
00162 try:
00163 buff.write(_struct_i.pack(self.objectId))
00164 _x = self.Objecttype
00165 length = len(_x)
00166 if python3 or type(_x) == unicode:
00167 _x = _x.encode('utf-8')
00168 length = len(_x)
00169 buff.write(struct.pack('<I%ss'%length, length, _x))
00170 _x = self.pose
00171 length = len(_x)
00172 if python3 or type(_x) == unicode:
00173 _x = _x.encode('utf-8')
00174 length = len(_x)
00175 buff.write(struct.pack('<I%ss'%length, length, _x))
00176 _x = self.fileDescription
00177 length = len(_x)
00178 if python3 or type(_x) == unicode:
00179 _x = _x.encode('utf-8')
00180 length = len(_x)
00181 buff.write(struct.pack('<I%ss'%length, length, _x))
00182 _x = self.bs
00183 length = len(_x)
00184
00185 if type(_x) in [list, tuple]:
00186 buff.write(struct.pack('<I%sB'%length, length, *_x))
00187 else:
00188 buff.write(struct.pack('<I%ss'%length, length, _x))
00189 buff.write(_struct_i.pack(self.size))
00190 except struct.error as se: self._check_types(se)
00191 except TypeError as te: self._check_types(te)
00192
00193 def deserialize_numpy(self, str, numpy):
00194 """
00195 unpack serialized message in str into this message instance using numpy for array types
00196 :param str: byte array of serialized message, ``str``
00197 :param numpy: numpy python module
00198 """
00199 try:
00200 end = 0
00201 start = end
00202 end += 4
00203 (self.objectId,) = _struct_i.unpack(str[start:end])
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 start = end
00208 end += length
00209 if python3:
00210 self.Objecttype = str[start:end].decode('utf-8')
00211 else:
00212 self.Objecttype = str[start:end]
00213 start = end
00214 end += 4
00215 (length,) = _struct_I.unpack(str[start:end])
00216 start = end
00217 end += length
00218 if python3:
00219 self.pose = str[start:end].decode('utf-8')
00220 else:
00221 self.pose = str[start:end]
00222 start = end
00223 end += 4
00224 (length,) = _struct_I.unpack(str[start:end])
00225 start = end
00226 end += length
00227 if python3:
00228 self.fileDescription = str[start:end].decode('utf-8')
00229 else:
00230 self.fileDescription = str[start:end]
00231 start = end
00232 end += 4
00233 (length,) = _struct_I.unpack(str[start:end])
00234 start = end
00235 end += length
00236 if python3:
00237 self.bs = str[start:end].decode('utf-8')
00238 else:
00239 self.bs = str[start:end]
00240 start = end
00241 end += 4
00242 (self.size,) = _struct_i.unpack(str[start:end])
00243 return self
00244 except struct.error as e:
00245 raise genpy.DeserializationError(e)
00246
00247 _struct_I = genpy.struct_I
00248 _struct_i = struct.Struct("<i")