Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PerceptualTaskBase.h

Go to the documentation of this file.
00001 #ifndef PERCEPTUAL_TASK_BASE_H_
00002 #define PERCEPTUAL_TASK_BASE_H_
00003 
00004 // INCLUDES
00005 // c++
00006 #include <string>
00007 #include <vector>
00008 
00009 // tekkotsu
00010 #include "Crew/MapBuilderRequest.h"
00011 #include "Crew/PilotRequest.h"
00012 #include "DualCoding/ShapeRoot.h"
00013 
00014 namespace Kodu {
00015 
00016     // tekkodu forward declarations
00017     class KoduWorld;
00018 
00019     enum PerceptualTaskType_t {
00020         PT_VIS_BUMP_DETECTION = 0,
00021         PT_GRIPPER_VIS_MONITOR,
00022         PT_VIS_LOCALIZATION,
00023         PT_VIS_NAV_ERR_MON
00024     };
00025 
00026     class PerceptualTaskBase {
00027     public:
00028         enum TaskStatus_t {
00029             TS_IN_PROGRESS = 0,
00030             TS_COMPLETE,
00031             TS_SUCCESSFUL,
00032             TS_FAILURE
00033         };
00034 
00035         //! Constructor
00036         PerceptualTaskBase(PerceptualTaskType_t perceptTaskType, unsigned int taskId)
00037           : type(perceptTaskType),
00038             id(taskId),
00039             mapreq(),
00040             taskStatus(TS_IN_PROGRESS)
00041         {
00042           // std::cout << "Created task #" << id << std::endl;
00043         }
00044 
00045         //! Copy constructor
00046         PerceptualTaskBase(const PerceptualTaskBase& kTask)
00047           : type(kTask.type),
00048             id(kTask.id),
00049             mapreq(kTask.mapreq),
00050             taskStatus(kTask.taskStatus)
00051         { }
00052 
00053         //! Destructor
00054         virtual ~PerceptualTaskBase() {
00055             // no explicit implementation
00056         }
00057 
00058         //! Assignment operator
00059         PerceptualTaskBase& operator=(const PerceptualTaskBase& kTask) {
00060             if (this != &kTask) {
00061                 type = kTask.type;
00062                 id = kTask.id;
00063                 mapreq = kTask.mapreq;
00064                 taskStatus = kTask.taskStatus;
00065             }
00066             return *this;
00067         }
00068 
00069         //! Checks if a task can execute (reimplemented in all derived class)
00070         virtual bool canExecute(const KoduWorld&) = 0;
00071 
00072         //! Examines the results from a task
00073         virtual void examineTaskResults();
00074 
00075         //! Returns the MapBuilder request the robot should perform
00076         virtual const DualCoding::MapBuilderRequest& getMapBuilderRequest();
00077 
00078         //! Returns the Pilot request the robot should perform
00079         virtual const DualCoding::PilotRequest getPilotRequest() { return PilotRequest(); }
00080 
00081         //! Returns the task's current status
00082         TaskStatus_t getStatus() const;
00083 
00084         //! Returns the task's id
00085         float getTaskId() const;
00086 
00087         //! Returns the task type
00088         PerceptualTaskType_t getType() const;
00089 
00090         void setTaskStatus(TaskStatus_t);
00091 
00092         //! Checks whether a task is complete
00093         virtual bool taskIsComplete(const KoduWorld&);
00094 
00095     protected:
00096         PerceptualTaskType_t type;              //!< The type of perceptual task
00097         unsigned int id;                        //!< The task's id
00098         DualCoding::MapBuilderRequest mapreq;   //!< The MapBuilder request the robot needs to perform
00099         TaskStatus_t taskStatus;                //!< The (current) status of a perceptual task
00100     };
00101 }
00102 
00103 
00104 #endif // PERCEPTUAL_TASK_BASE_H_

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