00001
00002 #ifndef INCLUDED_Lookout_h_
00003 #define INCLUDED_Lookout_h_
00004
00005 #include <queue>
00006 #include "Behaviors/BehaviorBase.h"
00007 #include "Motion/MotionManager.h"
00008 #include "Motion/MotionSequenceMC.h"
00009 #include "Events/VisionObjectEvent.h"
00010 #include "LookoutRequests.h"
00011
00012 namespace DualCoding {
00013
00014 class LookoutRequest;
00015 class StoreModeImageRequest;
00016 class ModeImageRequest;
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class Lookout : public BehaviorBase {
00028 public:
00029
00030 Lookout();
00031
00032 virtual ~Lookout() {}
00033
00034 virtual void DoStart();
00035 virtual void DoStop();
00036 virtual void processEvent(const EventBase& event);
00037
00038 static std::string getClassDescription() { return "moves head according to request"; }
00039 virtual std::string getDescription() const { return getClassDescription(); }
00040
00041 virtual unsigned int executeRequest(const LookoutRequest&);
00042
00043
00044
00045
00046
00047
00048 static Point findLocationFor(float, float);
00049 static const unsigned int Invalid_LO_ID=(unsigned int)-1;
00050
00051 protected:
00052 virtual void executeRequest();
00053 virtual void requestComplete();
00054 template<class T>
00055 void pushRequest(const LookoutRequest& req) {
00056 requests.push(new T(*dynamic_cast<const T*>(&req)));
00057 }
00058
00059
00060
00061 void processPointAt(const EventBase& event);
00062 bool findPixelModes(StoreModeImageRequest& modeRequest);
00063 void getData();
00064
00065
00066 void processTrack(const EventBase& event);
00067 void processTrackVision(float normX, float normY, bool isCurrentlyVisible);
00068 void trackObjectAt(float normX, float normY); //! tracks point at [normX,normY] in cam frame
00069 Point findLocationFor(float, float);
00070 */
00071
00072 void processScan(const EventBase& event);
00073 void scan();
00074 void scanAlongLine(const Point& start,const Point& end);
00075 void scanArea(coordinate_t left, coordinate_t right,
00076 coordinate_t far, coordinate_t near);
00077
00078
00079 Point findLocationFor(const VisionObjectEvent* voe) {
00080 return findLocationFor(voe->getCenterX(), voe->getCenterY());
00081 }
00082 Point findLocationFor(const CMVision::region* reg) {
00083 return findLocationFor
00084 (2.0*reg->cen_x/VRmixin::camSkS.getWidth()-1.0,
00085 2.0*reg->cen_y/VRmixin::camSkS.getHeight()-1.0);
00086 }
00087
00088 void storeVisionRegionDataTo(vector<Point>&, const set<int>&, int);
00089 void storeIRDataTo(vector<Point>&);
00090
00091
00092 private:
00093 Lookout& operator=(const Lookout&);
00094 Lookout(const Lookout&);
00095
00096 protected:
00097 MotionManager::MC_ID pointer_id;
00098 MotionManager::MC_ID sequence_id;
00099 queue<LookoutRequest*> requests;
00100 LookoutRequest *curReq;
00101 bool landmarkInView;
00102 unsigned int idCounter;
00103
00104 enum LookoutTimerSourceId_t {
00105 start_pan,
00106 pan_complete,
00107 reset_pan,
00108 no_event,
00109 dur_timer,
00110 scan_timer,
00111 };
00112 };
00113
00114 }
00115
00116 #endif