$search
00001 """autogenerated by genmsg_py from MaskArray.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import cob_object_detection_msgs.msg 00006 import sensor_msgs.msg 00007 import std_msgs.msg 00008 00009 class MaskArray(roslib.message.Message): 00010 _md5sum = "1d4620a4218f096b919a95d7fb64146f" 00011 _type = "cob_object_detection_msgs/MaskArray" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """Header header 00014 Mask[] masks 00015 00016 ================================================================================ 00017 MSG: std_msgs/Header 00018 # Standard metadata for higher-level stamped data types. 00019 # This is generally used to communicate timestamped data 00020 # in a particular coordinate frame. 00021 # 00022 # sequence ID: consecutively increasing ID 00023 uint32 seq 00024 #Two-integer timestamp that is expressed as: 00025 # * stamp.secs: seconds (stamp_secs) since epoch 00026 # * stamp.nsecs: nanoseconds since stamp_secs 00027 # time-handling sugar is provided by the client library 00028 time stamp 00029 #Frame this data is associated with 00030 # 0: no frame 00031 # 1: global frame 00032 string frame_id 00033 00034 ================================================================================ 00035 MSG: cob_object_detection_msgs/Mask 00036 # this message is used to mark where an object is present in an image 00037 # this can be done either by a roi region on the image (less precise) or a mask (more precise) 00038 00039 Rect roi 00040 00041 # in the case when mask is used, 'roi' specifies the image region and 'mask' 00042 # (which should be of the same size) a binary mask in that region 00043 sensor_msgs/Image mask 00044 00045 # in the case there is 3D data available, 'indices' are used to index the 00046 # part of the point cloud representing the object 00047 #pcl/PointIndices indices 00048 00049 ================================================================================ 00050 MSG: cob_object_detection_msgs/Rect 00051 int32 x 00052 int32 y 00053 int32 width 00054 int32 height 00055 00056 ================================================================================ 00057 MSG: sensor_msgs/Image 00058 # This message contains an uncompressed image 00059 # (0, 0) is at top-left corner of image 00060 # 00061 00062 Header header # Header timestamp should be acquisition time of image 00063 # Header frame_id should be optical frame of camera 00064 # origin of frame should be optical center of cameara 00065 # +x should point to the right in the image 00066 # +y should point down in the image 00067 # +z should point into to plane of the image 00068 # If the frame_id here and the frame_id of the CameraInfo 00069 # message associated with the image conflict 00070 # the behavior is undefined 00071 00072 uint32 height # image height, that is, number of rows 00073 uint32 width # image width, that is, number of columns 00074 00075 # The legal values for encoding are in file src/image_encodings.cpp 00076 # If you want to standardize a new string format, join 00077 # ros-users@lists.sourceforge.net and send an email proposing a new encoding. 00078 00079 string encoding # Encoding of pixels -- channel meaning, ordering, size 00080 # taken from the list of strings in src/image_encodings.cpp 00081 00082 uint8 is_bigendian # is this data bigendian? 00083 uint32 step # Full row length in bytes 00084 uint8[] data # actual matrix data, size is (step * rows) 00085 00086 """ 00087 __slots__ = ['header','masks'] 00088 _slot_types = ['Header','cob_object_detection_msgs/Mask[]'] 00089 00090 def __init__(self, *args, **kwds): 00091 """ 00092 Constructor. Any message fields that are implicitly/explicitly 00093 set to None will be assigned a default value. The recommend 00094 use is keyword arguments as this is more robust to future message 00095 changes. You cannot mix in-order arguments and keyword arguments. 00096 00097 The available fields are: 00098 header,masks 00099 00100 @param args: complete set of field values, in .msg order 00101 @param kwds: use keyword arguments corresponding to message field names 00102 to set specific fields. 00103 """ 00104 if args or kwds: 00105 super(MaskArray, self).__init__(*args, **kwds) 00106 #message fields cannot be None, assign default values for those that are 00107 if self.header is None: 00108 self.header = std_msgs.msg._Header.Header() 00109 if self.masks is None: 00110 self.masks = [] 00111 else: 00112 self.header = std_msgs.msg._Header.Header() 00113 self.masks = [] 00114 00115 def _get_types(self): 00116 """ 00117 internal API method 00118 """ 00119 return self._slot_types 00120 00121 def serialize(self, buff): 00122 """ 00123 serialize message into buffer 00124 @param buff: buffer 00125 @type buff: StringIO 00126 """ 00127 try: 00128 _x = self 00129 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00130 _x = self.header.frame_id 00131 length = len(_x) 00132 buff.write(struct.pack('<I%ss'%length, length, _x)) 00133 length = len(self.masks) 00134 buff.write(_struct_I.pack(length)) 00135 for val1 in self.masks: 00136 _v1 = val1.roi 00137 _x = _v1 00138 buff.write(_struct_4i.pack(_x.x, _x.y, _x.width, _x.height)) 00139 _v2 = val1.mask 00140 _v3 = _v2.header 00141 buff.write(_struct_I.pack(_v3.seq)) 00142 _v4 = _v3.stamp 00143 _x = _v4 00144 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00145 _x = _v3.frame_id 00146 length = len(_x) 00147 buff.write(struct.pack('<I%ss'%length, length, _x)) 00148 _x = _v2 00149 buff.write(_struct_2I.pack(_x.height, _x.width)) 00150 _x = _v2.encoding 00151 length = len(_x) 00152 buff.write(struct.pack('<I%ss'%length, length, _x)) 00153 _x = _v2 00154 buff.write(_struct_BI.pack(_x.is_bigendian, _x.step)) 00155 _x = _v2.data 00156 length = len(_x) 00157 # - if encoded as a list instead, serialize as bytes instead of string 00158 if type(_x) in [list, tuple]: 00159 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00160 else: 00161 buff.write(struct.pack('<I%ss'%length, length, _x)) 00162 except struct.error as se: self._check_types(se) 00163 except TypeError as te: self._check_types(te) 00164 00165 def deserialize(self, str): 00166 """ 00167 unpack serialized message in str into this message instance 00168 @param str: byte array of serialized message 00169 @type str: str 00170 """ 00171 try: 00172 if self.header is None: 00173 self.header = std_msgs.msg._Header.Header() 00174 end = 0 00175 _x = self 00176 start = end 00177 end += 12 00178 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00179 start = end 00180 end += 4 00181 (length,) = _struct_I.unpack(str[start:end]) 00182 start = end 00183 end += length 00184 self.header.frame_id = str[start:end] 00185 start = end 00186 end += 4 00187 (length,) = _struct_I.unpack(str[start:end]) 00188 self.masks = [] 00189 for i in range(0, length): 00190 val1 = cob_object_detection_msgs.msg.Mask() 00191 _v5 = val1.roi 00192 _x = _v5 00193 start = end 00194 end += 16 00195 (_x.x, _x.y, _x.width, _x.height,) = _struct_4i.unpack(str[start:end]) 00196 _v6 = val1.mask 00197 _v7 = _v6.header 00198 start = end 00199 end += 4 00200 (_v7.seq,) = _struct_I.unpack(str[start:end]) 00201 _v8 = _v7.stamp 00202 _x = _v8 00203 start = end 00204 end += 8 00205 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00206 start = end 00207 end += 4 00208 (length,) = _struct_I.unpack(str[start:end]) 00209 start = end 00210 end += length 00211 _v7.frame_id = str[start:end] 00212 _x = _v6 00213 start = end 00214 end += 8 00215 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end]) 00216 start = end 00217 end += 4 00218 (length,) = _struct_I.unpack(str[start:end]) 00219 start = end 00220 end += length 00221 _v6.encoding = str[start:end] 00222 _x = _v6 00223 start = end 00224 end += 5 00225 (_x.is_bigendian, _x.step,) = _struct_BI.unpack(str[start:end]) 00226 start = end 00227 end += 4 00228 (length,) = _struct_I.unpack(str[start:end]) 00229 start = end 00230 end += length 00231 _v6.data = str[start:end] 00232 self.masks.append(val1) 00233 return self 00234 except struct.error as e: 00235 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00236 00237 00238 def serialize_numpy(self, buff, numpy): 00239 """ 00240 serialize message with numpy array types into buffer 00241 @param buff: buffer 00242 @type buff: StringIO 00243 @param numpy: numpy python module 00244 @type numpy module 00245 """ 00246 try: 00247 _x = self 00248 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00249 _x = self.header.frame_id 00250 length = len(_x) 00251 buff.write(struct.pack('<I%ss'%length, length, _x)) 00252 length = len(self.masks) 00253 buff.write(_struct_I.pack(length)) 00254 for val1 in self.masks: 00255 _v9 = val1.roi 00256 _x = _v9 00257 buff.write(_struct_4i.pack(_x.x, _x.y, _x.width, _x.height)) 00258 _v10 = val1.mask 00259 _v11 = _v10.header 00260 buff.write(_struct_I.pack(_v11.seq)) 00261 _v12 = _v11.stamp 00262 _x = _v12 00263 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00264 _x = _v11.frame_id 00265 length = len(_x) 00266 buff.write(struct.pack('<I%ss'%length, length, _x)) 00267 _x = _v10 00268 buff.write(_struct_2I.pack(_x.height, _x.width)) 00269 _x = _v10.encoding 00270 length = len(_x) 00271 buff.write(struct.pack('<I%ss'%length, length, _x)) 00272 _x = _v10 00273 buff.write(_struct_BI.pack(_x.is_bigendian, _x.step)) 00274 _x = _v10.data 00275 length = len(_x) 00276 # - if encoded as a list instead, serialize as bytes instead of string 00277 if type(_x) in [list, tuple]: 00278 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00279 else: 00280 buff.write(struct.pack('<I%ss'%length, length, _x)) 00281 except struct.error as se: self._check_types(se) 00282 except TypeError as te: self._check_types(te) 00283 00284 def deserialize_numpy(self, str, numpy): 00285 """ 00286 unpack serialized message in str into this message instance using numpy for array types 00287 @param str: byte array of serialized message 00288 @type str: str 00289 @param numpy: numpy python module 00290 @type numpy: module 00291 """ 00292 try: 00293 if self.header is None: 00294 self.header = std_msgs.msg._Header.Header() 00295 end = 0 00296 _x = self 00297 start = end 00298 end += 12 00299 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00300 start = end 00301 end += 4 00302 (length,) = _struct_I.unpack(str[start:end]) 00303 start = end 00304 end += length 00305 self.header.frame_id = str[start:end] 00306 start = end 00307 end += 4 00308 (length,) = _struct_I.unpack(str[start:end]) 00309 self.masks = [] 00310 for i in range(0, length): 00311 val1 = cob_object_detection_msgs.msg.Mask() 00312 _v13 = val1.roi 00313 _x = _v13 00314 start = end 00315 end += 16 00316 (_x.x, _x.y, _x.width, _x.height,) = _struct_4i.unpack(str[start:end]) 00317 _v14 = val1.mask 00318 _v15 = _v14.header 00319 start = end 00320 end += 4 00321 (_v15.seq,) = _struct_I.unpack(str[start:end]) 00322 _v16 = _v15.stamp 00323 _x = _v16 00324 start = end 00325 end += 8 00326 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00327 start = end 00328 end += 4 00329 (length,) = _struct_I.unpack(str[start:end]) 00330 start = end 00331 end += length 00332 _v15.frame_id = str[start:end] 00333 _x = _v14 00334 start = end 00335 end += 8 00336 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end]) 00337 start = end 00338 end += 4 00339 (length,) = _struct_I.unpack(str[start:end]) 00340 start = end 00341 end += length 00342 _v14.encoding = str[start:end] 00343 _x = _v14 00344 start = end 00345 end += 5 00346 (_x.is_bigendian, _x.step,) = _struct_BI.unpack(str[start:end]) 00347 start = end 00348 end += 4 00349 (length,) = _struct_I.unpack(str[start:end]) 00350 start = end 00351 end += length 00352 _v14.data = str[start:end] 00353 self.masks.append(val1) 00354 return self 00355 except struct.error as e: 00356 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00357 00358 _struct_I = roslib.message.struct_I 00359 _struct_3I = struct.Struct("<3I") 00360 _struct_BI = struct.Struct("<BI") 00361 _struct_2I = struct.Struct("<2I") 00362 _struct_4i = struct.Struct("<4i")