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