19 #ifndef SNARK_FILTER_SIMPLE_CONSTANT_SPEED_H
20 #define SNARK_FILTER_SIMPLE_CONSTANT_SPEED_H
27 template<
unsigned int N >
31 typedef Eigen::Matrix< double, ( N << 1 ), 1 > state_type;
32 typedef Eigen::Matrix< double, ( N << 1 ), ( N << 1 ) > covariance_type;
38 state(
const state_type& s );
41 static const unsigned int dimension = ( N << 1 );
42 state_type state_vector;
43 covariance_type covariance;
49 model(
double noiseSigma );
51 const covariance_type&
jacobian(
const state & s,
double dt );
59 covariance_type noise;
65 typedef Eigen::Matrix< double, N, 1 > position_type;
67 position(
const position_type& p,
double sigma );
69 const Eigen::Matrix< double, N, ( N << 1 ) >& measurement_jacobian(
const state & s )
const
74 const Eigen::Matrix< double, N, N >& measurement_covariance(
const state & s )
const
79 position_type innovation(
const state& s )
const
81 return ( position_vector - jacobian * s.state_vector );
84 static const int dimension = N;
85 position_type position_vector;
86 Eigen::Matrix< double, N, N > covariance;
87 Eigen::Matrix< double, N, ( N << 1 ) > jacobian;
93 template<
unsigned int N >
95 state_vector( state_type::Zero() ),
96 covariance( covariance_type::Zero() )
102 template<
unsigned int N >
105 covariance( covariance_type::Zero() )
111 template<
unsigned int N >
114 state_vector += innovation;
121 template<
unsigned int N >
123 sigma( state_type::Ones() * noiseSigma ),
124 A( covariance_type::Identity() ),
125 noise( covariance_type::Zero() )
131 template<
unsigned int N >
134 A.block( 0, N, N, N ) = Eigen::Matrix< double, N, N >::Identity() * dt;
139 template<
unsigned int N >
142 s.state_vector = A * s.state_vector;
146 template<
unsigned int N >
149 for(
unsigned int i = 0; i < ( N << 1 ); i++ )
151 noise(i,i) = dt * sigma[i];
159 template<
unsigned int N >
161 position_vector( p ),
162 covariance( Eigen::Matrix< double, N, N >::Identity()*sigma ),
163 jacobian( Eigen::Matrix< double, N, ( N << 1 ) >::Identity() )
171 #endif // SNARK_FILTER_SIMPLE_CONSTANT_SPEED_H