6 template<
class VECTOR,
class MATRIX,
class T1>
9 virtual VECTOR transition(VECTOR t, T1 timeUnit) = 0;
10 virtual MATRIX transitionJacobian(VECTOR t, T1 timeUnit) = 0;
11 virtual VECTOR measurement(VECTOR t, T1 timeUnit) = 0;
12 virtual MATRIX measurementJacobian(VECTOR t, T1 timeUnit) = 0;
13 virtual MATRIX getProcessNoiseCovariance(VECTOR t,T1 time) = 0;
14 virtual MATRIX getSensorNoiseCovariance(VECTOR t,T1 time) = 0;
15 virtual MATRIX getProcessNoiseCovarianceSqrt(VECTOR t,T1 time) = 0;
16 virtual MATRIX getSensorNoiseCovarianceSqrt(VECTOR t,T1 time) = 0;
17 virtual int getSensorCount() = 0;
18 virtual int getStateCount() = 0;
21 template<
class VECTOR,
class MATRIX>
43 transitionModel(transitionModel),measurementModel(measurementModel),
44 processNoise(processNoise),sensorNoise(sensorNoise),
45 transitionJac(transitionJac),measurementJac(measurementJac),
46 stateCount(stateCount),sensorCount(sensorCount){}
56 VECTOR transition(VECTOR t,
int time){
57 return transitionModel->
function(t,time);
60 MATRIX transitionJacobian(VECTOR t,
int time){
61 return transitionJac->
function(t,time);
64 VECTOR measurement(VECTOR t,
int time){
65 return measurementModel->
function(t,time);
68 MATRIX measurementJacobian(VECTOR t,
int time){
69 return measurementJac->
function(t,time);
72 MATRIX getProcessNoiseCovariance(VECTOR t,
int time){
73 return processNoise->
function(t,time);
77 MATRIX getProcessNoiseCovarianceSqrt(VECTOR t,
int time){
78 return processNoise->sqrt(t,time);
81 MATRIX getSensorNoiseCovariance(VECTOR t,
int time){
82 return sensorNoise->
function(t,time);
85 MATRIX getSensorNoiseCovarianceSqrt(VECTOR t,
int time){
86 return sensorNoise->sqrt(t,time);
94 template<
class VECTOR,
class MATRIX>
102 VECTOR * solvedMeasurements;
103 VECTOR * solvedStates;
104 bool usedMeasurementsPointer;
105 bool usedStatesPointer;
111 solvedMeasurements = NULL;
113 usedMeasurementsPointer =
true;
114 usedStatesPointer =
true;
118 :model(model),time(initialTime),currentState(initialCondition){
119 uint32_t seed = std::random_device()();
120 solvedMeasurements = NULL;
122 usedMeasurementsPointer =
true;
123 usedStatesPointer =
true;
126 VECTOR * getSolvedMeasurements(){
127 usedMeasurementsPointer =
true;
128 return solvedMeasurements;
131 VECTOR * getSolvedStates(){
132 usedStatesPointer =
true;
136 void setSeed(uint32_t s){
144 VECTOR * solve(
int steps){
145 int stateCount = model->getStateCount();
146 int sensorCount = model->getSensorCount();
147 if(usedMeasurementsPointer==
false){
148 delete [] solvedMeasurements;
150 if(usedStatesPointer==
false){
151 delete [] solvedStates;
153 usedMeasurementsPointer =
false;
154 usedStatesPointer =
false;
156 solvedMeasurements =
new VECTOR[steps];
158 solvedStates =
new VECTOR[steps];
161 for(
int i = 0; i < steps; i++){
162 currentState = model->transition(currentState,time + i);
163 currentState = currentState +
164 model->getProcessNoiseCovarianceSqrt(currentState,time + i)*VECTOR::randomVector(stateCount,seed+i);
165 measurement = model->measurement(currentState,time + i);
166 measurement = measurement +
167 model->getSensorNoiseCovarianceSqrt(currentState,time)*VECTOR::randomVector(sensorCount,seed-i);
169 solvedStates[i] = currentState;
170 solvedMeasurements[i] = measurement;
Definition: filterModel.h:7
virtual T function(const T &val, const int index) const =0
virtual MATRIX function(const VECTOR &val, int t)=0
Pure virtual method returning Jacobian of some function.
Definition: filterModel.h:22
virtual MATRIX function(const VECTOR &val, int t)=0
Pure virtual method returning Jacobian of some function.
Definition: filterModel.h:95