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