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