36 #include <Base/Math/Random.hh>
37 #include <StateEstimator/ExtendedKalman.hh>
40 #include <Base/Common/W32Compat.hh>
51 virtual ~MyKalman(){};
73 int main(
int argc,
char ** argv )
76 cout <<
"Give number of iterations!" << endl;
91 int maxIter = atoi(argv[1]);
109 filter.SetInitial(state, 100.0*cov);
111 filter.SetMeasureDerive(
id,
id);
112 filter.SetStateDerive(
id, zero);
114 filter.SetMeasureCov(cov);
116 filter.SetProcessCov(zero);
118 double sum1 = 0, sum2 = 0;
121 for (
int i=0; i<maxIter; i++) {
125 sum1 += observation[0];
128 sum2 += observation[1];
130 filter.Update(observation);
132 filter.Predict(ctrlparam);
136 filter.GetState(state);
143 cout <<
"should be 1: " << mean1 <<
" 2: " << mean2
145 cout <<
"kalman state 1: " << state[0] <<
" 2: " << state[1]
147 cout <<
"avarage: 1: " << sum1/double(maxIter) <<
" 2: "
148 << sum2/double(maxIter) << endl << flush;
void Reset()
calls srand() with a seed generated from system call time, also initializes some other variables ...
Classical ExtendedKalman-filter (EKF).
double GetNormalDistributed(const double mean, const double sigma)
on succesive calls return normal distributed random variable with mean and standard deviation sigma ...
class for producing random numbers from different distributions