Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Modules/BehaviorControl/CommonXabsl2Symbols/AngleSymbols.h

Go to the documentation of this file.

    00001 /**
    00002 * @file AngleSymbols.h
    00003 *
    00004 * Declaration of class AngleSymbols.
    00005 *
    00006 * @author Matthias Jüngel
    00007 */
    00008
    00009 #ifndef __AngleSymbols_h_
    00010 #define __AngleSymbols_h_
    00011
    00012 #include "../BehaviorControl.h"
    00013 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
    00014 #include "Tools/FieldDimensions.h"
    00015 #include "Tools/Actorics/RobotDimensions.h"
    00016
    00017 /**
    00018 * The Xabsl2 symbols that are defined in "angle-symbols.xml"
    00019 *
    00020 * @author Matthias Jüngel
    00021 */
    00022 class AngleSymbols : public Xabsl2FunctionProvider, public BehaviorControlInterfaces
    00023 {
    00024 public:
    00025 /*
    00026 * Constructor.
    00027 * @param interfaces The paramters of the BehaviorControl module.
    00028   */
    00029   AngleSymbols(const BehaviorControlInterfaces& interfaces);
    00030
    00031   /** registers the symbols at an engine */
    00032   void registerSymbols(Xabsl2Engine& engine);
    00033
    00034     /** updates the symbols */
    00035   void update();
    00036
    00037   //!@name Input symbols
    00038   //!@{
    00039
    00040   //localisation based:
    00041   double getAngleToCenterOfField(); /*!< calculates the value for the symbol "robot-pose.best-angle-away-from-own-goal" */
    00042   double getAngleToBbSupporter();
    00043   double getAngleToOpponentGoal(); /*!< A function for the symbol "robot-pose.angle-to-opponent-goal" */
    00044   double getAngleToPointBehindOpponentGoal(); /*!< calculates the value for the symbol "robot-pose.angle-to-point-behind-opponent-goal" */
    00045   double getAngleToCenterOfOpponentPenaltyArea(); /*!< calculates the value for the symbol "robot-pose.angle-to-center-of-opponent-penalty-area" */
    00046
    00047     // combined: vision + odometry modelling + localisation
    00048   double getPerfectAngleToOpponentGoal(); /*!< calculates the value for the symbol "robot-pose.best-angle-to-opponent-goal" */
    00049
    00050   // combined: vision + localisation
    00051   double getBestAngleToOpponentGoal(); /*!< calculates the value for the symbol "robot-pose.best-angle-to-opponent-goal" */
    00052   double getBestAngleToOpponentGoalNoObstacles(); /*!< calculates the value for the symbol "robot-pose.best-angle-to-opponent-goal-no-obstacles" */
    00053   double getBestWidthOfOpponentGoal(); /*!< calculates the value for the symbol "robot-pose.best-width-of-opponent-goal" */
    00054   double getBestWidthOfOpponentGoalNoObstacles(); /*!< calculates the value for the symbol "robot-pose.best-width-of-opponent-goal-no-obstacles" */
    00055   double getBestAngleAwayFromOwnGoal(); /*!< calculates the value for the symbol "robot-pose.best-angle-away-from-own-goal" */
    00056   double getBestAngleAwayFromOwnGoalNoObstacles(); /*!< calculates the value for the symbol "robot-pose.best-angle-away-from-own-goal-no-obstacles" */
    00057   double getGoalieGoalKickAngle(); /*!< calculates the value for the symbol "goalie.goal-kick-angle" */
    00058   double getTimeSinceOpponentGoalDetection(); /*!< calculates the value for the symbol "angle.time-since-opponent-goal-detected" />*/
    00059
    00060   // vision based + odometry in not seen cases
    00061   double getSeenAngleToOpponentGoal(); /*!< calculates the value for the symbol "angle.seen-angle-to-opponent-goal" */
    00062   double getTimeSinceLastSeenOpponentGoal(); /*!< calculates the value for the symbol "angle.time-since-last-seen-opponent-goal" />*/
    00063   bool getTrustOfSeenAngleToOpponentGoal();
    00064
    00065
    00066
    00067   double getTestAngle();
    00068
    00069   //!@}
    00070
    00071   /** The angle that is shown by the top white LEDs */
    00072   enum Angles {
    00073     undefined,
    00074     //localisation based:
    00075     angleToCenterOfField,                //input symbol
    00076     angleToBbSupporter,
    00077     angleToOpponentGoal,                 //input symbol
    00078     angleToLeftOpponentGoalPost,
    00079     angleToRightOpponentGoalPost,
    00080     angleToLeftOpponentGoalCorner,
    00081     angleToRightOpponentGoalCorner,
    00082     angleToPointBehindOpponentGoal,      //input symbol
    00083     angleToCenterOfOpponentPenaltyArea,
    00084
    00085     // vision based
    00086     angleToFreePartOfOpponentGoalLeft,
    00087     angleToFreePartOfOpponentGoalRight,
    00088     angleToFreePartOfOpponentGoal,
    00089     widthOfFreePartOfOpponentGoal,
    00090
    00091     // combined: vision + odometry modelling + localisation
    00092     perfectAngleToOpponentGoal,          //input symbol
    00093     // combined: vision + localisation
    00094     bestAngleToOpponentGoal,             //input symbol
    00095     bestWidthOfOpponentGoal,             //input symbol
    00096     bestAngleToOpponentGoalNoObstacles,  //input symbol
    00097     bestWidthOfOpponentGoalNoObstacles,  //input symbol
    00098     bestAngleAwayFromOwnGoal,            //input symbol
    00099     bestAngleAwayFromOwnGoalNoObstacles, //input symbol
    00100     goalieGoalKickAngle,                 //input symbol
    00101
    00102     // vision + odometry(non seen cases) based
    00103     seenAngleToOpponentGoal,
    00104     testAngle,                           //input symbol
    00105
    00106     numberOfAngles
    00107   };
    00108
    00109   double getAngle(Angles id);
    00110
    00111   static const char* getAngleName(Angles id)
    00112   {
    00113     switch(id)
    00114     {
    00115     case undefined: return "undefined";
    00116     //localisation based:
    00117     case angleToCenterOfField: return "angleToCenterOfField";
    00118   case angleToBbSupporter: return "angleToBbSupporter";
    00119     case angleToOpponentGoal: return "angleToOpponentGoal";
    00120     case angleToLeftOpponentGoalPost: return "angleToLeftOpponentGoalPost";
    00121     case angleToRightOpponentGoalPost: return "angleToRightOpponentGoalPost";
    00122     case angleToLeftOpponentGoalCorner: return "angleToLeftOpponentGoalCorner";
    00123     case angleToRightOpponentGoalCorner: return "angleToRightOpponentGoalCorner";
    00124     case angleToPointBehindOpponentGoal: return "angleToPointBehindOpponentGoal";
    00125     case angleToCenterOfOpponentPenaltyArea: return "angleToCenterOfOpponentPenaltyArea";
    00126
    00127     // vision based
    00128     case angleToFreePartOfOpponentGoalLeft: return "angleToFreePartOfOpponentGoalLeft";
    00129     case angleToFreePartOfOpponentGoalRight: return "angleToFreePartOfOpponentGoalRight";
    00130     case angleToFreePartOfOpponentGoal: return "angleToFreePartOfOpponentGoal";
    00131     case widthOfFreePartOfOpponentGoal: return "widthOfFreePartOfOpponentGoal";
    00132
    00133     // combined: vision + odometry modelling + localisation
    00134     case perfectAngleToOpponentGoal: return "perfectAngleToOpponentGoal";
    00135     // combined: vision + localisation
    00136     case bestAngleToOpponentGoal: return "bestAngleToOpponentGoal";
    00137     case bestWidthOfOpponentGoal: return "bestWidthOfOpponentGoal";
    00138     case bestAngleToOpponentGoalNoObstacles: return "bestAngleToOpponentGoalNoObstacles";
    00139     case bestWidthOfOpponentGoalNoObstacles: return "bestWidthOfOpponentGoalNoObstacles";
    00140     case bestAngleAwayFromOwnGoal: return "bestAngleAwayFromOwnGoal";
    00141     case bestAngleAwayFromOwnGoalNoObstacles: return "bestAngleAwayFromOwnGoalNoObstacles";
    00142     case goalieGoalKickAngle: return "goalieGoalKickAngle";
    00143
    00144       // vision based + odometry in non seen cases
    00145     case seenAngleToOpponentGoal: return "seenAngleToOpponentGoal";
    00146
    00147     case testAngle: return "testAngle";
    00148     default: return "please-edit-angle-name";
    00149     }
    00150   }
    00151
    00152   Angles angleShownByLEDs;
    00153   void drawAngleShownByLeds();
    00154   void drawAngles();
    00155   Angles angleUsedForPerfectAngle;
    00156
    00157 private:
    00158   void setTestAngle();
    00159   void calculateVisionBasedAngles();
    00160   void calculateLocalisationBasedAngles();
    00161   void calculateCombinedAngles();
    00162   double angles[numberOfAngles];
    00163   bool angleIsUsedByTheCurrentBehavior[numberOfAngles];
    00164 };
    00165
    00166
    00167 #endif // __AngleSymbols_h_
    00168