Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraCalibrationBehavior.h

Go to the documentation of this file.
00001 #ifndef _CameraCalibrationBehavior_h_
00002 #define _CameraCalibrationBehavior_h_
00003 
00004 //#include "Motion/LedMC.h"
00005 //#include "Motion/MMAccessor.h"
00006 #include "Motion/MotionManager.h"
00007 
00008 #include "DualCoding/DualCoding.h"
00009 using namespace DualCoding;
00010 
00011 //Timers IDs and Intervals
00012 #define SEARCH_TIMER_ID 7753
00013 #define SEARCH_TIME_INTERVAL 5000
00014 #define CHECK_IS_LED_TIMER_ID 6684
00015 #define CHECK_IS_LED_TIMER_INVERVAL 2000
00016 #define STOP_TIMER_ID 8832
00017 #define STOP_TIME_INTERVAL 3000
00018 
00019 //thresholds for blob size when converting diff sketch into blobs
00020 #define MAX_LED_AREA_THRESHOLD 800
00021 #define LED_AREA_THRESHOLD 100
00022 #define WEAK_LED_AREA_THRESHOLD 30
00023 
00024 #define PARTIAL_VISION_THRESHOLD 3 //number of consecutive times of seeing
00025                                    //small(large) diff blobs
00026                                    //before we drop(raise) our diff threshold
00027 //threshold on the diff sketch to filter out noise (may change)
00028 #define STARTING_DIFF_THRESHOLD 40
00029 
00030 //These values move the camera half the size of the camera frame
00031 #define SEARCH_PAN_INCREMENT -.25f
00032 #define SEARCH_TILT_INCREMENT .2f
00033 
00034 #define RIGHT_LED_MASK (1)
00035 #define LEFT_LED_MASK (1<<9)
00036 
00037 //! A behavior to calibrate the camera using the robots own LEDs as reference
00038 class CameraCalibrationBehavior : public VisualRoutinesBehavior {
00039  public:
00040  CameraCalibrationBehavior() 
00041    : VisualRoutinesBehavior("CameraCalibrationBehavior"),
00042     leds_id(MotionManager::invalid_MC_ID),
00043     headpointer_id(MotionManager::invalid_MC_ID),
00044     currentPan(RobotInfo::outputRanges[HeadOffset + PanOffset][MaxRange]),
00045     currentTilt(RobotInfo::outputRanges[HeadOffset + TiltOffset][MinRange]),
00046     leftLEDPan(0),leftLEDTilt(0),
00047     currentLEDMask(LEFT_LED_MASK),
00048     partial_vision_count(0),
00049     diffThreshold(STARTING_DIFF_THRESHOLD){}
00050 
00051   virtual ~CameraCalibrationBehavior() {}
00052 
00053   virtual void doStart();
00054 
00055   virtual void doStop();
00056 
00057   virtual void moveToNextSearchPoint();
00058 
00059   virtual void doEvent();
00060 
00061   static std::string getClassDescription() {return "Calibrate the camera using own LEDs";}
00062   virtual std::string getDescription() const {return getClassDescription();}
00063 
00064  protected:
00065   MotionManager::MC_ID leds_id;
00066   MotionManager::MC_ID headpointer_id;
00067   float currentPan, currentTilt;
00068   float leftLEDPan, leftLEDTilt;
00069   int currentLEDMask;
00070   int partial_vision_count;
00071   uint diffThreshold;
00072 
00073 };
00074 
00075 
00076 #endif

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