00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ARANALOGGYRO_H
00028 #define ARANALOGGYRO_H
00029
00030 #include "ariaTypedefs.h"
00031 #include "ariaUtil.h"
00032 #include "ArFunctor.h"
00033
00034 class ArRobot;
00035 class ArRobotPacket;
00036
00038
00089 class ArAnalogGyro
00090 {
00091 public:
00093 ArAnalogGyro(ArRobot *robot);
00095 virtual ~ArAnalogGyro();
00097 bool isActive(void) { return myIsActive; }
00099 void activate(void);
00101 void deactivate(void);
00103 bool haveGottenData(void) { return myHaveGottenData; }
00105 double getHeading(void) const { return myHeading; }
00107 int getTemperature(void) const { return myTemperature; }
00109
00119 void setFilterModel(double gyroSigma, double inertialVar,
00120 double rotVar, double transVar)
00121 { myGyroSigma = gyroSigma; myInertialVarianceModel = inertialVar;
00122 myRotVarianceModel = rotVar; myTransVarianceModel = transVar; };
00123
00125 int getPacCount(void) { return myPacCount; }
00126
00128 double getAverage(void) const { return myLastAverage; }
00130 ArTime getAverageTaken(void) const { return myLastAverageTaken; }
00132 double getScalingFactor(void) const { return myScalingFactor; }
00134 void setScalingFactor(double factor) { myScalingFactor = factor; }
00135
00137 bool handleGyroPacket(ArRobotPacket *packet);
00139 double encoderCorrect(ArPoseWithTime deltaPose);
00141 void stabilizingCallback(void);
00143 void setLogAnomalies(bool logAnomalies) { myLogAnomalies = logAnomalies; }
00144 protected:
00145
00146 bool myIsActive;
00147
00148 bool myHaveGottenData;
00149
00150 double myScalingFactor;
00151
00152 bool myReadingThisCycle;
00153
00154 bool myLogAnomalies;
00155
00156 int myPacCount;
00157 int myPacCurrentCount;
00158 time_t myTimeLastPacket;
00159
00160
00161 ArTime myAverageStarted;
00162 double myLastAverage;
00163 ArTime myLastAverageTaken;
00164 double myAverageTotal;
00165 int myAverageCount;
00166
00167
00168
00169 double myGyroSigma;
00170 double myInertialVarianceModel;
00171 double myRotVarianceModel;
00172 double myTransVarianceModel;
00173
00174
00175
00176 double myAccumulatedDelta;
00177
00178 double myHeading;
00179 int myTemperature;
00180 double myLastHeading;
00181 ArRobot *myRobot;
00182 ArRetFunctor1C<bool, ArAnalogGyro, ArRobotPacket *> myHandleGyroPacketCB;
00183 ArRetFunctor1C<double, ArAnalogGyro, ArPoseWithTime> myEncoderCorrectCB;
00184 ArFunctorC<ArAnalogGyro> myStabilizingCB;
00185 };
00186
00187 #endif // ARANALOGGYRO_H
00188
00189