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