00001 /** 00002 * @file SlamPercept.h 00003 * 00004 * Declaration of class SlamPercept. 00005 * 00006 * @author Tobias Wegner 00007 */ 00008 00009 #include "Tools/Math/Vector2.h" 00010 #include "Tools/Math/Geometry.h" 00011 #include "Modules/ImageProcessor/SlamImageProcessor/SlamFlagLocator.h" 00012 00013 00014 struct ImageCharacteristic 00015 { 00016 double averageY; 00017 double averageU; 00018 double averageV; 00019 00020 double filteredAverageY; 00021 double filteredAverageU; 00022 double filteredAverageV; 00023 00024 int numPink; 00025 00026 double angle; 00027 }; 00028 00029 struct CenterCircleInformation 00030 { 00031 bool centerCircleIsVisible; 00032 double distanceToCenterCircle; 00033 double directionToCenterCircle; 00034 double seenCenterCircleOrientation; 00035 double timeSinceLastSeenCenterCircle; 00036 unsigned long timeStampOfLastSeenCenterCircle; 00037 }; 00038 00039 struct WLanBearing 00040 { 00041 bool inProgress; 00042 bool finished; 00043 00044 bool facingBlue; 00045 00046 double direction; 00047 00048 double posCenter; 00049 double negCenter; 00050 }; 00051 00052 struct GreenLocation 00053 { 00054 bool greenLocationFinished; 00055 00056 bool impAngleToMaxGreenValid; 00057 double impAngleToMaxGreen; 00058 double impLengthOfMaxGreen; 00059 00060 bool angleToMaxGreenValid; 00061 double angleToMaxGreen; 00062 double lengthOfMaxGreen; 00063 00064 Vector2<int> maxGreenPointInImage; 00065 Vector2<int> maxGreenPointOnField; 00066 }; 00067 00068 class SlamPercept 00069 { 00070 public: 00071 SlamPercept () 00072 { 00073 centerCircleInformation.centerCircleIsVisible = false; 00074 }; 00075 00076 enum SlamState 00077 { 00078 SlamStart, 00079 DebugJustLearn, 00080 DebugJustRecognize, 00081 LocalizeWithFlags, 00082 LearnNewFlags, 00083 LocalizeUsingNewFlags, 00084 UseNewFlags, 00085 EvaluatePosition, 00086 numOfSlamStates 00087 }; 00088 00089 SlamFlagLocator flagLocator; 00090 00091 mutable SlamState slamState; 00092 00093 double viewAngle; /**< The estimated viewing angle in field coords. */ 00094 bool viewAngleValid; /**< Tells the self locator if the view angle is valid. */ 00095 00096 ImageCharacteristic imageCharacteristic; 00097 00098 bool turnFinished; 00099 00100 static char *getSlamStateName (SlamPercept::SlamState state) 00101 { 00102 switch (state) 00103 { 00104 case SlamStart: return "slam-start"; 00105 case DebugJustLearn: return "debug-just-learn"; 00106 case DebugJustRecognize: return "debug-just-recognize"; 00107 case LocalizeWithFlags: return "localize-with-flags"; 00108 case LearnNewFlags: return "learn-new-flags"; 00109 case LocalizeUsingNewFlags: return "localize-using-new-flags"; 00110 case UseNewFlags: return "use-new-flags"; 00111 default: return "unknown"; 00112 }; 00113 }; 00114 00115 CenterCircleInformation centerCircleInformation; 00116 00117 GreenLocation greenLocation; 00118 00119 WLanBearing wlanBearing; 00120 00121 double GPVal; 00122 00123 //old stuff 00124 struct PositionElement 00125 { 00126 Vector3<double> measurement; 00127 Vector2<double> fieldPos; 00128 }; 00129 00130 enum SelfLocatorLearnMode 00131 { 00132 evaluatePosition, 00133 runWithKnownDirection 00134 }; 00135 00136 PositionElement testPoints[4]; 00137 bool testPointsMeasured; 00138 SelfLocatorLearnMode slLearnMode; 00139 00140 // characterization: #pink, brightest angle, darkest angle 00141 Vector3<double> currentMeasurement; 00142 };
1.3.6