00001 """autogenerated by genpy from vrep_common/ObjectGroupData.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 ObjectGroupData(genpy.Message):
00010 _md5sum = "d73f2682eafdfd3c477ba05ceeae1ada"
00011 _type = "vrep_common/ObjectGroupData"
00012 _has_header = False
00013 _full_text = """std_msgs/Int32MultiArray handles
00014 std_msgs/Int32MultiArray intData
00015 std_msgs/Float32MultiArray floatData
00016 std_msgs/String stringData
00017
00018 ================================================================================
00019 MSG: std_msgs/Int32MultiArray
00020 # Please look at the MultiArrayLayout message definition for
00021 # documentation on all multiarrays.
00022
00023 MultiArrayLayout layout # specification of data layout
00024 int32[] data # array of data
00025
00026
00027 ================================================================================
00028 MSG: std_msgs/MultiArrayLayout
00029 # The multiarray declares a generic multi-dimensional array of a
00030 # particular data type. Dimensions are ordered from outer most
00031 # to inner most.
00032
00033 MultiArrayDimension[] dim # Array of dimension properties
00034 uint32 data_offset # padding bytes at front of data
00035
00036 # Accessors should ALWAYS be written in terms of dimension stride
00037 # and specified outer-most dimension first.
00038 #
00039 # multiarray(i,j,k) = data[data_offset + dim_stride[1]*i + dim_stride[2]*j + k]
00040 #
00041 # A standard, 3-channel 640x480 image with interleaved color channels
00042 # would be specified as:
00043 #
00044 # dim[0].label = "height"
00045 # dim[0].size = 480
00046 # dim[0].stride = 3*640*480 = 921600 (note dim[0] stride is just size of image)
00047 # dim[1].label = "width"
00048 # dim[1].size = 640
00049 # dim[1].stride = 3*640 = 1920
00050 # dim[2].label = "channel"
00051 # dim[2].size = 3
00052 # dim[2].stride = 3
00053 #
00054 # multiarray(i,j,k) refers to the ith row, jth column, and kth channel.
00055 ================================================================================
00056 MSG: std_msgs/MultiArrayDimension
00057 string label # label of given dimension
00058 uint32 size # size of given dimension (in type units)
00059 uint32 stride # stride of given dimension
00060 ================================================================================
00061 MSG: std_msgs/Float32MultiArray
00062 # Please look at the MultiArrayLayout message definition for
00063 # documentation on all multiarrays.
00064
00065 MultiArrayLayout layout # specification of data layout
00066 float32[] data # array of data
00067
00068
00069 ================================================================================
00070 MSG: std_msgs/String
00071 string data
00072
00073 """
00074 __slots__ = ['handles','intData','floatData','stringData']
00075 _slot_types = ['std_msgs/Int32MultiArray','std_msgs/Int32MultiArray','std_msgs/Float32MultiArray','std_msgs/String']
00076
00077 def __init__(self, *args, **kwds):
00078 """
00079 Constructor. Any message fields that are implicitly/explicitly
00080 set to None will be assigned a default value. The recommend
00081 use is keyword arguments as this is more robust to future message
00082 changes. You cannot mix in-order arguments and keyword arguments.
00083
00084 The available fields are:
00085 handles,intData,floatData,stringData
00086
00087 :param args: complete set of field values, in .msg order
00088 :param kwds: use keyword arguments corresponding to message field names
00089 to set specific fields.
00090 """
00091 if args or kwds:
00092 super(ObjectGroupData, self).__init__(*args, **kwds)
00093
00094 if self.handles is None:
00095 self.handles = std_msgs.msg.Int32MultiArray()
00096 if self.intData is None:
00097 self.intData = std_msgs.msg.Int32MultiArray()
00098 if self.floatData is None:
00099 self.floatData = std_msgs.msg.Float32MultiArray()
00100 if self.stringData is None:
00101 self.stringData = std_msgs.msg.String()
00102 else:
00103 self.handles = std_msgs.msg.Int32MultiArray()
00104 self.intData = std_msgs.msg.Int32MultiArray()
00105 self.floatData = std_msgs.msg.Float32MultiArray()
00106 self.stringData = std_msgs.msg.String()
00107
00108 def _get_types(self):
00109 """
00110 internal API method
00111 """
00112 return self._slot_types
00113
00114 def serialize(self, buff):
00115 """
00116 serialize message into buffer
00117 :param buff: buffer, ``StringIO``
00118 """
00119 try:
00120 length = len(self.handles.layout.dim)
00121 buff.write(_struct_I.pack(length))
00122 for val1 in self.handles.layout.dim:
00123 _x = val1.label
00124 length = len(_x)
00125 if python3 or type(_x) == unicode:
00126 _x = _x.encode('utf-8')
00127 length = len(_x)
00128 buff.write(struct.pack('<I%ss'%length, length, _x))
00129 _x = val1
00130 buff.write(_struct_2I.pack(_x.size, _x.stride))
00131 buff.write(_struct_I.pack(self.handles.layout.data_offset))
00132 length = len(self.handles.data)
00133 buff.write(_struct_I.pack(length))
00134 pattern = '<%si'%length
00135 buff.write(struct.pack(pattern, *self.handles.data))
00136 length = len(self.intData.layout.dim)
00137 buff.write(_struct_I.pack(length))
00138 for val1 in self.intData.layout.dim:
00139 _x = val1.label
00140 length = len(_x)
00141 if python3 or type(_x) == unicode:
00142 _x = _x.encode('utf-8')
00143 length = len(_x)
00144 buff.write(struct.pack('<I%ss'%length, length, _x))
00145 _x = val1
00146 buff.write(_struct_2I.pack(_x.size, _x.stride))
00147 buff.write(_struct_I.pack(self.intData.layout.data_offset))
00148 length = len(self.intData.data)
00149 buff.write(_struct_I.pack(length))
00150 pattern = '<%si'%length
00151 buff.write(struct.pack(pattern, *self.intData.data))
00152 length = len(self.floatData.layout.dim)
00153 buff.write(_struct_I.pack(length))
00154 for val1 in self.floatData.layout.dim:
00155 _x = val1.label
00156 length = len(_x)
00157 if python3 or type(_x) == unicode:
00158 _x = _x.encode('utf-8')
00159 length = len(_x)
00160 buff.write(struct.pack('<I%ss'%length, length, _x))
00161 _x = val1
00162 buff.write(_struct_2I.pack(_x.size, _x.stride))
00163 buff.write(_struct_I.pack(self.floatData.layout.data_offset))
00164 length = len(self.floatData.data)
00165 buff.write(_struct_I.pack(length))
00166 pattern = '<%sf'%length
00167 buff.write(struct.pack(pattern, *self.floatData.data))
00168 _x = self.stringData.data
00169 length = len(_x)
00170 if python3 or type(_x) == unicode:
00171 _x = _x.encode('utf-8')
00172 length = len(_x)
00173 buff.write(struct.pack('<I%ss'%length, length, _x))
00174 except struct.error as se: self._check_types(se)
00175 except TypeError as te: self._check_types(te)
00176
00177 def deserialize(self, str):
00178 """
00179 unpack serialized message in str into this message instance
00180 :param str: byte array of serialized message, ``str``
00181 """
00182 try:
00183 if self.handles is None:
00184 self.handles = std_msgs.msg.Int32MultiArray()
00185 if self.intData is None:
00186 self.intData = std_msgs.msg.Int32MultiArray()
00187 if self.floatData is None:
00188 self.floatData = std_msgs.msg.Float32MultiArray()
00189 if self.stringData is None:
00190 self.stringData = std_msgs.msg.String()
00191 end = 0
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 self.handles.layout.dim = []
00196 for i in range(0, length):
00197 val1 = std_msgs.msg.MultiArrayDimension()
00198 start = end
00199 end += 4
00200 (length,) = _struct_I.unpack(str[start:end])
00201 start = end
00202 end += length
00203 if python3:
00204 val1.label = str[start:end].decode('utf-8')
00205 else:
00206 val1.label = str[start:end]
00207 _x = val1
00208 start = end
00209 end += 8
00210 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00211 self.handles.layout.dim.append(val1)
00212 start = end
00213 end += 4
00214 (self.handles.layout.data_offset,) = _struct_I.unpack(str[start:end])
00215 start = end
00216 end += 4
00217 (length,) = _struct_I.unpack(str[start:end])
00218 pattern = '<%si'%length
00219 start = end
00220 end += struct.calcsize(pattern)
00221 self.handles.data = struct.unpack(pattern, str[start:end])
00222 start = end
00223 end += 4
00224 (length,) = _struct_I.unpack(str[start:end])
00225 self.intData.layout.dim = []
00226 for i in range(0, length):
00227 val1 = std_msgs.msg.MultiArrayDimension()
00228 start = end
00229 end += 4
00230 (length,) = _struct_I.unpack(str[start:end])
00231 start = end
00232 end += length
00233 if python3:
00234 val1.label = str[start:end].decode('utf-8')
00235 else:
00236 val1.label = str[start:end]
00237 _x = val1
00238 start = end
00239 end += 8
00240 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00241 self.intData.layout.dim.append(val1)
00242 start = end
00243 end += 4
00244 (self.intData.layout.data_offset,) = _struct_I.unpack(str[start:end])
00245 start = end
00246 end += 4
00247 (length,) = _struct_I.unpack(str[start:end])
00248 pattern = '<%si'%length
00249 start = end
00250 end += struct.calcsize(pattern)
00251 self.intData.data = struct.unpack(pattern, str[start:end])
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 self.floatData.layout.dim = []
00256 for i in range(0, length):
00257 val1 = std_msgs.msg.MultiArrayDimension()
00258 start = end
00259 end += 4
00260 (length,) = _struct_I.unpack(str[start:end])
00261 start = end
00262 end += length
00263 if python3:
00264 val1.label = str[start:end].decode('utf-8')
00265 else:
00266 val1.label = str[start:end]
00267 _x = val1
00268 start = end
00269 end += 8
00270 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00271 self.floatData.layout.dim.append(val1)
00272 start = end
00273 end += 4
00274 (self.floatData.layout.data_offset,) = _struct_I.unpack(str[start:end])
00275 start = end
00276 end += 4
00277 (length,) = _struct_I.unpack(str[start:end])
00278 pattern = '<%sf'%length
00279 start = end
00280 end += struct.calcsize(pattern)
00281 self.floatData.data = struct.unpack(pattern, str[start:end])
00282 start = end
00283 end += 4
00284 (length,) = _struct_I.unpack(str[start:end])
00285 start = end
00286 end += length
00287 if python3:
00288 self.stringData.data = str[start:end].decode('utf-8')
00289 else:
00290 self.stringData.data = str[start:end]
00291 return self
00292 except struct.error as e:
00293 raise genpy.DeserializationError(e)
00294
00295
00296 def serialize_numpy(self, buff, numpy):
00297 """
00298 serialize message with numpy array types into buffer
00299 :param buff: buffer, ``StringIO``
00300 :param numpy: numpy python module
00301 """
00302 try:
00303 length = len(self.handles.layout.dim)
00304 buff.write(_struct_I.pack(length))
00305 for val1 in self.handles.layout.dim:
00306 _x = val1.label
00307 length = len(_x)
00308 if python3 or type(_x) == unicode:
00309 _x = _x.encode('utf-8')
00310 length = len(_x)
00311 buff.write(struct.pack('<I%ss'%length, length, _x))
00312 _x = val1
00313 buff.write(_struct_2I.pack(_x.size, _x.stride))
00314 buff.write(_struct_I.pack(self.handles.layout.data_offset))
00315 length = len(self.handles.data)
00316 buff.write(_struct_I.pack(length))
00317 pattern = '<%si'%length
00318 buff.write(self.handles.data.tostring())
00319 length = len(self.intData.layout.dim)
00320 buff.write(_struct_I.pack(length))
00321 for val1 in self.intData.layout.dim:
00322 _x = val1.label
00323 length = len(_x)
00324 if python3 or type(_x) == unicode:
00325 _x = _x.encode('utf-8')
00326 length = len(_x)
00327 buff.write(struct.pack('<I%ss'%length, length, _x))
00328 _x = val1
00329 buff.write(_struct_2I.pack(_x.size, _x.stride))
00330 buff.write(_struct_I.pack(self.intData.layout.data_offset))
00331 length = len(self.intData.data)
00332 buff.write(_struct_I.pack(length))
00333 pattern = '<%si'%length
00334 buff.write(self.intData.data.tostring())
00335 length = len(self.floatData.layout.dim)
00336 buff.write(_struct_I.pack(length))
00337 for val1 in self.floatData.layout.dim:
00338 _x = val1.label
00339 length = len(_x)
00340 if python3 or type(_x) == unicode:
00341 _x = _x.encode('utf-8')
00342 length = len(_x)
00343 buff.write(struct.pack('<I%ss'%length, length, _x))
00344 _x = val1
00345 buff.write(_struct_2I.pack(_x.size, _x.stride))
00346 buff.write(_struct_I.pack(self.floatData.layout.data_offset))
00347 length = len(self.floatData.data)
00348 buff.write(_struct_I.pack(length))
00349 pattern = '<%sf'%length
00350 buff.write(self.floatData.data.tostring())
00351 _x = self.stringData.data
00352 length = len(_x)
00353 if python3 or type(_x) == unicode:
00354 _x = _x.encode('utf-8')
00355 length = len(_x)
00356 buff.write(struct.pack('<I%ss'%length, length, _x))
00357 except struct.error as se: self._check_types(se)
00358 except TypeError as te: self._check_types(te)
00359
00360 def deserialize_numpy(self, str, numpy):
00361 """
00362 unpack serialized message in str into this message instance using numpy for array types
00363 :param str: byte array of serialized message, ``str``
00364 :param numpy: numpy python module
00365 """
00366 try:
00367 if self.handles is None:
00368 self.handles = std_msgs.msg.Int32MultiArray()
00369 if self.intData is None:
00370 self.intData = std_msgs.msg.Int32MultiArray()
00371 if self.floatData is None:
00372 self.floatData = std_msgs.msg.Float32MultiArray()
00373 if self.stringData is None:
00374 self.stringData = std_msgs.msg.String()
00375 end = 0
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 self.handles.layout.dim = []
00380 for i in range(0, length):
00381 val1 = std_msgs.msg.MultiArrayDimension()
00382 start = end
00383 end += 4
00384 (length,) = _struct_I.unpack(str[start:end])
00385 start = end
00386 end += length
00387 if python3:
00388 val1.label = str[start:end].decode('utf-8')
00389 else:
00390 val1.label = str[start:end]
00391 _x = val1
00392 start = end
00393 end += 8
00394 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00395 self.handles.layout.dim.append(val1)
00396 start = end
00397 end += 4
00398 (self.handles.layout.data_offset,) = _struct_I.unpack(str[start:end])
00399 start = end
00400 end += 4
00401 (length,) = _struct_I.unpack(str[start:end])
00402 pattern = '<%si'%length
00403 start = end
00404 end += struct.calcsize(pattern)
00405 self.handles.data = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00406 start = end
00407 end += 4
00408 (length,) = _struct_I.unpack(str[start:end])
00409 self.intData.layout.dim = []
00410 for i in range(0, length):
00411 val1 = std_msgs.msg.MultiArrayDimension()
00412 start = end
00413 end += 4
00414 (length,) = _struct_I.unpack(str[start:end])
00415 start = end
00416 end += length
00417 if python3:
00418 val1.label = str[start:end].decode('utf-8')
00419 else:
00420 val1.label = str[start:end]
00421 _x = val1
00422 start = end
00423 end += 8
00424 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00425 self.intData.layout.dim.append(val1)
00426 start = end
00427 end += 4
00428 (self.intData.layout.data_offset,) = _struct_I.unpack(str[start:end])
00429 start = end
00430 end += 4
00431 (length,) = _struct_I.unpack(str[start:end])
00432 pattern = '<%si'%length
00433 start = end
00434 end += struct.calcsize(pattern)
00435 self.intData.data = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00436 start = end
00437 end += 4
00438 (length,) = _struct_I.unpack(str[start:end])
00439 self.floatData.layout.dim = []
00440 for i in range(0, length):
00441 val1 = std_msgs.msg.MultiArrayDimension()
00442 start = end
00443 end += 4
00444 (length,) = _struct_I.unpack(str[start:end])
00445 start = end
00446 end += length
00447 if python3:
00448 val1.label = str[start:end].decode('utf-8')
00449 else:
00450 val1.label = str[start:end]
00451 _x = val1
00452 start = end
00453 end += 8
00454 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00455 self.floatData.layout.dim.append(val1)
00456 start = end
00457 end += 4
00458 (self.floatData.layout.data_offset,) = _struct_I.unpack(str[start:end])
00459 start = end
00460 end += 4
00461 (length,) = _struct_I.unpack(str[start:end])
00462 pattern = '<%sf'%length
00463 start = end
00464 end += struct.calcsize(pattern)
00465 self.floatData.data = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00466 start = end
00467 end += 4
00468 (length,) = _struct_I.unpack(str[start:end])
00469 start = end
00470 end += length
00471 if python3:
00472 self.stringData.data = str[start:end].decode('utf-8')
00473 else:
00474 self.stringData.data = str[start:end]
00475 return self
00476 except struct.error as e:
00477 raise genpy.DeserializationError(e)
00478
00479 _struct_I = genpy.struct_I
00480 _struct_2I = struct.Struct("<2I")