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