Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

VisualNavErrMonTask.h

Go to the documentation of this file.
00001 #ifndef VISUAL_NAV_ERR_MON_TASK_H_
00002 #define VISUAL_NAV_ERR_MON_TASK_H_
00003 
00004 // INCLUDES
00005 // c++
00006 #include <vector>
00007 
00008 // tekkotsu
00009 #include "DualCoding/ShapeRoot.h"
00010 
00011 namespace Kodu {
00012 
00013     // tekkodu forward declarations
00014     class PerceptualTaskBase;
00015     
00016     /**
00017      * ASSUMPTIONS:
00018      * - The target shape passed to the constructor is in the world shape space.
00019      *
00020     **/
00021     class VisualNavErrMonTask : public PerceptualTaskBase {
00022     public:
00023         //! Constructor #1
00024         VisualNavErrMonTask(const DualCoding::ShapeRoot& kTargetShape)
00025           : PerceptualTaskBase(PT_VIS_NAV_ERR_MON, ++idCount),
00026             errorCount(0),
00027             targets(),
00028             agentLastOrientation(0.0f)
00029         {
00030             targets.push_back(kTargetShape);
00031             std::cout << "Created VisualNavErrorMonTask #" << id << " to track " << kTargetShape << std::endl;
00032         }
00033 
00034         //! Constructor #2
00035         VisualNavErrMonTask(const std::vector<DualCoding::ShapeRoot>& kTargetShapes)
00036           : PerceptualTaskBase(PT_VIS_NAV_ERR_MON, ++idCount),
00037             errorCount(0),
00038             targets(kTargetShapes),
00039             agentLastOrientation(0.0f)
00040         { }
00041 
00042         //! Copy constructor
00043         VisualNavErrMonTask(const VisualNavErrMonTask& kTask)
00044           : PerceptualTaskBase(kTask),
00045             errorCount(kTask.errorCount),
00046             targets(kTask.targets),
00047             agentLastOrientation(kTask.agentLastOrientation)
00048         { }
00049 
00050         //! Destructor
00051         ~VisualNavErrMonTask() {
00052             // no explicit implementation
00053         }
00054 
00055         //! Assignment operator
00056         VisualNavErrMonTask& operator=(const VisualNavErrMonTask& kTask) {
00057             if (this != &kTask) {
00058                 PerceptualTaskBase::operator=(kTask);
00059                 errorCount = kTask.errorCount;
00060                 targets = kTask.targets;
00061                 agentLastOrientation = kTask.agentLastOrientation;
00062             }
00063             return *this;
00064         }
00065 
00066         //! Checks if the VisualWalkProgressTask can execute
00067         virtual bool canExecute(const KoduWorld&);
00068 
00069         //! Examines the results from the MapBuilder request to see if the robot made "progress"
00070         virtual void examineTaskResults();
00071 
00072         //! Dynamically generates the point the agent should fixate on
00073         virtual const DualCoding::MapBuilderRequest& getMapBuilderRequest();
00074 
00075         //! Checks if the task is complete
00076         virtual bool taskIsComplete(const KoduWorld&);
00077 
00078         //! The max number of cumulative errors (error: when the agent did not find a match)
00079         //static unsigned int const kMaxErrorOccurences;
00080 
00081     private:
00082         static unsigned int idCount;                //!< Used to generate id numbers
00083         unsigned int errorCount;                    //!< Cumulative error count
00084         std::vector<DualCoding::ShapeRoot> targets; //!< The shapes the agent needs to look at
00085         float agentLastOrientation;
00086     };
00087 
00088 }
00089 
00090 #endif // VISUAL_NAV_ERR_MON_TASK_H_

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