Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

VisualLocalizationTask.h

Go to the documentation of this file.
00001 #ifndef VISUAL_LOCALIZATION_TASK_H_
00002 #define VISUAL_LOCALIZATION_TASK_H_
00003 
00004 // INCLUDES
00005 // c++
00006 #include <iostream>
00007 
00008 // tekkotsu
00009 #include "Crew/PilotRequest.h"
00010 #include "DualCoding/Point.h"
00011 #include "DualCoding/ShapeFuns.h"
00012 #include "DualCoding/ShapePoint.h"
00013 #include "DualCoding/ShapeRoot.h"
00014 
00015 namespace Kodu {
00016 
00017     // tekkodu forward declarations
00018     class PerceptualTaskBase;
00019     
00020     class VisualLocalizationTask : public PerceptualTaskBase {
00021     public:
00022         //! Constructor
00023         VisualLocalizationTask(const std::map<int, DualCoding::Point>& kStarConstellation,
00024             int maxStarsNeededToLocalize = kMinStarsRequiredToLocalize)
00025           : PerceptualTaskBase(PT_VIS_LOCALIZATION, ++idCount),
00026             localizationPoints(kStarConstellation),
00027             maxStarsRequested(maxStarsNeededToLocalize)
00028         {
00029             if (maxStarsNeededToLocalize > static_cast<int>(localizationPoints.size())) {
00030                 std::cout << "VisualLocalizationTask: WARNING---you are requesting a max of "
00031                     << maxStarsNeededToLocalize << " stars, but there are only "
00032                     << localizationPoints.size() << " stars in the constellation (available).\n";
00033             }
00034 
00035             if (maxStarsNeededToLocalize < kMinStarsRequiredToLocalize) {
00036                 std::cout << "VisualLocalizationTask: WARNING---you are requesting a max of "
00037                     << maxStarsNeededToLocalize << " stars, but you need a minimun of "
00038                     << kMinStarsRequiredToLocalize << " stars to localize.\n";
00039                 maxStarsRequested = kMinStarsRequiredToLocalize;
00040             }
00041         }
00042 
00043         //! Copy constructor
00044         VisualLocalizationTask(const VisualLocalizationTask& kTask)
00045           : PerceptualTaskBase(kTask),
00046             localizationPoints(kTask.localizationPoints),
00047             maxStarsRequested(kTask.maxStarsRequested)
00048         { }
00049 
00050         //! Destructor
00051         ~VisualLocalizationTask() {
00052             // no explicit implementation
00053         }
00054 
00055         //! Assignment operator
00056         VisualLocalizationTask& operator=(const VisualLocalizationTask& kTask) {
00057             if (this != &kTask) {
00058                 PerceptualTaskBase::operator=(kTask);
00059                 localizationPoints = kTask.localizationPoints;
00060                 maxStarsRequested = kTask.maxStarsRequested;
00061             }
00062             return *this;
00063         }
00064 
00065         //! Checks if this task can execute
00066         virtual bool canExecute(const KoduWorld&);
00067 
00068         //! Generates the Pilot request the agent needs to localize
00069         virtual const DualCoding::PilotRequest getPilotRequest();
00070 
00071         static const int kMinStarsRequiredToLocalize;
00072         
00073     private:
00074         static unsigned int idCount;    //!< used to create an id for each task
00075         std::map<int, DualCoding::Point> localizationPoints;   //!< a copy of the constellation
00076         int maxStarsRequested;
00077     };
00078 }
00079 
00080 #endif // VISUAL_LOCALIZATION_TASK_H_

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:52 2016 by Doxygen 1.6.3