CameraCalibrationBehavior.h
Go to the documentation of this file.00001 #ifndef _CameraCalibrationBehavior_h_
00002 #define _CameraCalibrationBehavior_h_
00003
00004
00005
00006 #include "Motion/MotionManager.h"
00007
00008 #include "DualCoding/DualCoding.h"
00009 using namespace DualCoding;
00010
00011
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
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
00026
00027
00028 #define STARTING_DIFF_THRESHOLD 40
00029
00030
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
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