00001 /* 00002 * MKCalibrator.hpp 00003 * 00004 * Created on: Dec 7, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef MKCALIBRATOR_HPP_ 00009 #define MKCALIBRATOR_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 #include <tk_mkinterface/MKData.hpp> 00014 #include <tk_mkinterface/MKInterfaceConnection.hpp> 00015 00016 #include <telekyb_base/Options.hpp> 00017 00018 namespace TELEKYB_NAMESPACE { 00019 00020 struct GyroDrifts { 00021 int x; 00022 int y; 00023 int z; 00024 GyroDrifts() { 00025 x = 0; 00026 y = 0; 00027 z = 0; 00028 } 00029 }; 00030 00031 class MKCalibratorOptions : public OptionContainer { 00032 public: 00033 Option<double>* tDriftEstimTimeout; 00034 Option<int>* tDriftEstimDeltaThreshold; 00035 MKCalibratorOptions(); 00036 }; 00037 00038 class MKCalibrator : public MKDataListener { 00039 protected: 00040 MKCalibratorOptions options; 00041 MKInterfaceConnection* connection; 00042 bool gyroDriftEstimRunning; 00043 00044 // Algorithm Variables 00045 GyroDrifts driftCounters; // counters for x,y,z 00046 GyroDrifts driftEstimDone; // 0: not done. other: done! 00047 00048 GyroDrifts minDrifts; 00049 GyroDrifts maxDrifts; 00050 00051 public: 00052 MKCalibrator(MKInterfaceConnection* connection_); 00053 virtual ~MKCalibrator(); 00054 00055 bool doGyroDriftEstim(); 00056 00057 // Listener CB 00058 void dataValueUpdated(MKValue* value); 00059 }; 00060 00061 } /* namespace telekyb */ 00062 #endif /* MKCALIBRATOR_HPP_ */