00001 /** 00002 * @file SpecialPercept.h 00003 * 00004 * Declaration of class SpecialPercept 00005 * 00006 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A>, <A href=mailto:brunn@sim.tu-darmstadt.de>Ronnie Brunn</A> 00007 */ 00008 00009 #ifndef __SpecialPercept_h_ 00010 #define __SpecialPercept_h_ 00011 00012 00013 #include "Tools/Streams/InOut.h" 00014 #include "Tools/Math/Pose2D.h" 00015 #include "Tools/Math/Vector2.h" 00016 #include "Tools/Math/Geometry.h" 00017 #include "Tools/ColorClasses.h" 00018 00019 00020 00021 class SpecialLandmark 00022 { 00023 public: 00024 colorClass sectors[8]; 00025 Vector2<int> center; 00026 Vector2<int> size; 00027 Vector2<double> angles; 00028 }; 00029 00030 /** A class that contains a certain bitePoint at the open challenge bridge 00031 * @author <A href=mailto:jochen@kerdels.de>Jochen Kerdels</A> 00032 */ 00033 class BitePoint 00034 { 00035 public: 00036 /** Constructor */ 00037 BitePoint(); 00038 00039 /** The different bitePoints */ 00040 enum Position 00041 { 00042 none = -1, 00043 frontleft = 0, 00044 frontright, 00045 behindleft, 00046 behindright, 00047 master, 00048 numOfPositions 00049 }; 00050 00051 /** postion of the bitePoint at the oc bridge */ 00052 Position position; 00053 00054 /** relative angle to the bitePoint */ 00055 double angleTo; 00056 /** relative distance to the bitePoint */ 00057 double distanceTo; 00058 /** the relative position of the bitePoint */ 00059 Vector2<double> relPos; 00060 /** the preciseShift to either left or right 00061 * while in front of the bytePoint 00062 */ 00063 double preciseShift; 00064 00065 /** time when the bitePoint was last seen by the own camera */ 00066 unsigned long timeWhenLastSeen; 00067 00068 /** method to add a new percept */ 00069 void addPercept(double aAngleTo, double aDistanceTo, double aPreciseShift); 00070 00071 /** indicates fresh-data */ 00072 bool fresh; 00073 00074 /** last odometry-data */ 00075 Pose2D lastOdometry; 00076 00077 }; 00078 00079 /** 00080 * Streaming operator that reads a BitePoint from a stream. 00081 * @param stream The stream from which is read. 00082 * @param bitePoint The BitePoint object. 00083 * @return The stream. 00084 */ 00085 In& operator>>(In& stream,BitePoint& bitePoint); 00086 00087 /** 00088 * Streaming operator that writes a BitePoint to a stream. 00089 * @param stream The stream to write on. 00090 * @param bitePoint The BitePoint object. 00091 * @return The stream. 00092 */ 00093 Out& operator<<(Out& stream, const BitePoint& bitePoint); 00094 00095 00096 00097 00098 /** A class that contains data of the bridge for the openchallenge 00099 * @author <A href=mailto:jochen@kerdels.de>Jochen Kerdels</A> 00100 */ 00101 class OCBridge 00102 { 00103 public: 00104 /** Constructor */ 00105 OCBridge(); 00106 00107 /** The different Sides of the bridge */ 00108 enum Side 00109 { 00110 none = 0, 00111 left, 00112 right, 00113 numOfSides 00114 }; 00115 00116 /** side of the bridge actually last seen by the camera */ 00117 Side lastSeenSide; 00118 00119 /** relative angle to the bridge (middle of the sidemark) */ 00120 double angleTo; 00121 /** relative distance to the bridge (middle of the sidemark) */ 00122 double distanceTo; 00123 /** the relative position of the bridge (middle of the sidemark) */ 00124 Vector2<double> relPos; 00125 00126 /** time when the bridge was last seen by the own camera */ 00127 unsigned long timeWhenLastSeen; 00128 00129 /** the bitePoints of the bridge */ 00130 BitePoint bitePoint[BitePoint::numOfPositions]; 00131 00132 /** method to add a new percept */ 00133 void addPercept(double aAngleTo, double aDistanceTo); 00134 00135 /** indicates fresh-data */ 00136 bool fresh; 00137 00138 /** last odometry-data */ 00139 Pose2D lastOdometry; 00140 }; 00141 00142 /** 00143 * Streaming operator that reads a OCBridge from a stream. 00144 * @param stream The stream from which is read. 00145 * @param ocBridge The OCBridge object. 00146 * @return The stream. 00147 */ 00148 In& operator>>(In& stream,OCBridge& ocBridge); 00149 00150 /** 00151 * Streaming operator that writes a OCBridge to a stream. 00152 * @param stream The stream to write on. 00153 * @param ocBridge The OCBridge object. 00154 * @return The stream. 00155 */ 00156 Out& operator<<(Out& stream, const OCBridge& ocBridge); 00157 00158 00159 /** A class that contains data of the bridge's red line for the open challenge 00160 */ 00161 class OCRedLine 00162 { 00163 public: 00164 /** Constructor */ 00165 OCRedLine(); 00166 00167 /** flag to know if red Line has been seen or not */ 00168 bool seen; 00169 00170 /** Startpoint and endpont of red line 00171 The startpoint is nearer to the robot e.g. on the bottom of the image 00172 */ 00173 Vector2<int> lineStart; 00174 Vector2<int> lineEnd; 00175 Vector2<int> pointStart; 00176 Vector2<int> pointEnd; 00177 int angleInImage; // angle of red line in image. 0 is exactly vertical. 00178 unsigned long timeWhenLastSeen; /** time when the bridge was last seen by the own camera */ 00179 00180 00181 /** method to add a new percept */ 00182 void addPercept(Vector2<int> lineStart, Vector2<int> lineEnd, Vector2<int> pointStart,Vector2<int> pointEnd,int angleInImage); 00183 }; 00184 00185 /** 00186 * Streaming operator that reads a red line from a stream. 00187 * @param stream The stream from which is read. 00188 * @param ocRedLine the ocRedLine object. 00189 * @return The stream. 00190 */ 00191 In& operator>>(In& stream,OCRedLine& ocRedLine); 00192 00193 /** 00194 * Streaming operator that writes a red line to a stream. 00195 * @param stream The stream to write on. 00196 * @param ocRedLine The ocRedLine object. 00197 * @return The stream. 00198 */ 00199 Out& operator<<(Out& stream, const OCRedLine& ocRedLine); 00200 00201 00202 00203 /** A class that contains a certain specialPercept 00204 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A> 00205 * @author <A href=mailto:loetzsch@informatik.hu-berlin.de>Martin Lötzsch</A> 00206 */ 00207 class SpecialPercept 00208 { 00209 public: 00210 /** Constructor */ 00211 SpecialPercept(); 00212 00213 /** Reset special percept. */ 00214 void reset(unsigned long frameNum=0); 00215 00216 /** The different specialPercept types*/ 00217 enum Type 00218 { 00219 motionDetection, 00220 none, 00221 checkerboard, 00222 barCode, 00223 autoShutter, 00224 challengeOrientation, 00225 openChallengeBridge, 00226 openChallengeRedLine 00227 }; 00228 00229 /** The type of the specialPercept.*/ 00230 Type type; 00231 00232 /** test values (motion detection) */ 00233 double pan, tilt; 00234 Vector2<long> mostMovement, leastMovement; 00235 00236 /** values (checkerboard detection) */ 00237 Pose2D checkerPose; 00238 unsigned long frameNumber; 00239 00240 /** An id filled by the barCodeReader */ 00241 int barCodeId; 00242 00243 /** Orientation of the robot in the "Almost-Slam-Challenge" **/ 00244 double orientation; 00245 /** angle of pink Flags seen relative to robot **/ 00246 #define MAXSEENFLAGS 100 00247 #define MAXLEARNFLAGS 100 00248 double angleOfPinkFlags[MAXSEENFLAGS]; 00249 int countAngleOfPinkFlags; 00250 00251 /** values for open challenge bridge detection */ 00252 OCBridge ocBridge; 00253 00254 /** for red line detection */ 00255 OCRedLine ocRedLine; 00256 00257 /** indicates if Shutter was selected */ 00258 bool shutterSelected; 00259 00260 SpecialLandmark specialLandmarks[6]; 00261 int numOfSpecialLandmarks; 00262 }; 00263 00264 /** 00265 * Streaming operator that reads a SpecialPercept from a stream. 00266 * @param stream The stream from which is read. 00267 * @param specialPercept The SpecialPercept object. 00268 * @return The stream. 00269 */ 00270 In& operator>>(In& stream,SpecialPercept& specialPercept); 00271 00272 /** 00273 * Streaming operator that writes a SpecialPercept to a stream. 00274 * @param stream The stream to write on. 00275 * @param specialPercept The SpecialPercept object. 00276 * @return The stream. 00277 */ 00278 Out& operator<<(Out& stream, const SpecialPercept& specialPercept); 00279 00280 #endif //__SpecialPercept_h_ 00281 00282 /* 00283 * Change log : 00284 * 00285 * $Log: SpecialPercept.h,v $ 00286 * Revision 1.7 2004/07/22 22:38:23 kerdels 00287 * added DTT used by Open Challenge, RIP and Xabsl-Options will follow 00288 * 00289 * Revision 1.6 2004/07/02 10:11:47 nistico 00290 * Cloned main image processor and created 00291 * SpecialLandmarks specialist for SLAM challenge 00292 * 00293 * Revision 1.5 2004/07/01 18:42:08 hamerla 00294 * SLAM challenge find Orientation 00295 * 00296 * Revision 1.4 2004/06/29 15:10:57 kerdels 00297 * Special Vision AutoShutter... 00298 * 00299 * Revision 1.3 2004/06/28 12:58:17 wachter 00300 * Added special-percept for challenge and corresponding symbols. 00301 * 00302 * Revision 1.2 2004/06/01 13:58:14 schumann 00303 * special percept type redLine added, 00304 * part 1 of open challenge added 00305 * 00306 * Revision 1.1.1.1 2004/05/22 17:26:03 cvsadm 00307 * created new repository GT2004_WM 00308 * 00309 * Revision 1.7 2004/05/21 16:32:43 hamerla 00310 * no message 00311 * 00312 * Revision 1.6 2004/05/20 16:30:03 kerdels 00313 * further work on open challenge 00314 * 00315 * Revision 1.5 2004/05/17 01:56:16 kerdels 00316 * prepared some symbols for the open challenge bridge detection 00317 * 00318 * Revision 1.4 2004/01/19 14:53:46 dueffert 00319 * all frameNumbers (and not only some of them) are unsigned long now 00320 * 00321 * Revision 1.3 2003/11/14 19:02:26 goehring 00322 * frameNumber added 00323 * 00324 * Revision 1.2 2003/11/10 13:29:45 dueffert 00325 * frame number added 00326 * 00327 * Revision 1.1 2003/10/07 10:09:36 cvsadm 00328 * Created GT2004 (M.J.) 00329 * 00330 * Revision 1.2 2003/07/30 14:55:54 dueffert 00331 * checkerboard percept improved 00332 * 00333 * Revision 1.1.1.1 2003/07/02 09:40:22 cvsadm 00334 * created new repository for the competitions in Padova from the 00335 * tamara CVS (Tuesday 2:00 pm) 00336 * 00337 * removed unused solutions 00338 * 00339 * Revision 1.13 2003/05/26 08:12:10 juengel 00340 * Moved angleToFreePartOfGoal from specialPercept to obstaclesPercept. 00341 * 00342 * Revision 1.12 2003/05/01 10:20:58 roefer 00343 * Added distance and width for freePartOfO*Goal 00344 * 00345 * Revision 1.11 2003/04/26 08:19:32 roefer 00346 * reset() added 00347 * 00348 * Revision 1.10 2003/04/23 16:12:03 juengel 00349 * Added angleToFreePartOfOwnGoal. 00350 * 00351 * Revision 1.9 2003/04/02 13:20:37 juengel 00352 * Added SpecialPercept freePartOfOpponentGoal. 00353 * 00354 * Revision 1.8 2003/02/08 16:06:02 roefer 00355 * ID sequence changed to be compatible with existing log files 00356 * 00357 * Revision 1.7 2003/01/29 10:37:21 juengel 00358 * Added BarCodeReader. 00359 * 00360 * Revision 1.6 2003/01/22 15:20:25 dueffert 00361 * checkerboard stuff added 00362 * 00363 * Revision 1.5 2002/11/28 14:43:48 jhoffman 00364 * added a special percept for the motion detector 00365 * 00366 * Revision 1.4 2002/11/27 13:47:50 dueffert 00367 * doxygen docu corrected 00368 * 00369 * Revision 1.3 2002/09/25 12:05:43 loetzsch 00370 * removed BarPercept and PatternPercept 00371 * 00372 * Revision 1.2 2002/09/22 18:40:50 risler 00373 * added new math functions, removed GTMath library 00374 * 00375 * Revision 1.1 2002/09/10 15:26:40 cvsadm 00376 * Created new project GT2003 (M.L.) 00377 * - Cleaned up the /Src/DataTypes directory 00378 * - Removed Challenge Code 00379 * - Removed processing of incoming audio data 00380 * - Renamed AcousticMessage to SoundRequest 00381 * 00382 * Revision 1.11 2002/07/23 13:32:57 loetzsch 00383 * new streaming classes 00384 * 00385 * removed many #include statements 00386 * 00387 * Revision 1.10 2002/06/22 02:19:57 risler 00388 * barIsNear added 00389 * 00390 * Revision 1.9 2002/06/21 12:09:07 juengel 00391 * no message 00392 * 00393 * Revision 1.8 2002/06/17 19:24:13 mkunz 00394 * BarPerceptor searches for own end only now 00395 * 00396 * Revision 1.7 2002/06/11 17:39:00 vigerske 00397 * continued pattern perception 00398 * 00399 * Revision 1.6 2002/06/04 11:06:29 juengel 00400 * added rectangle 00401 * 00402 * Revision 1.5 2002/06/02 19:07:23 mkunz 00403 * no message 00404 * 00405 * Revision 1.4 2002/05/17 11:51:48 brunn 00406 * first experimental version of the barPerceptor 00407 * 00408 * Revision 1.3 2002/05/15 11:24:31 brunn 00409 * barEnd poses instead of complete bar pose 00410 * and initialization added 00411 * 00412 * Revision 1.2 2002/05/11 06:03:32 juengel 00413 * Constructor for PatternPercept added. 00414 * 00415 * Revision 1.1 2002/05/10 17:40:26 juengel 00416 * Added SpecialVision and SpecialPercept. 00417 * 00418 */