32 #ifndef _NONHOLONOMICKALMANFILTER_H_
33 #define _NONHOLONOMICKALMANFILTER_H_
41 #include <boost/shared_ptr.hpp>
42 #include <boost/format.hpp>
44 #include <Eigen/Dense>
45 #include <Eigen/Cholesky>
47 #include <kfilter/ekfilter.hpp>
49 using Eigen::Matrix4d;
50 using Eigen::Matrix2d;
51 using Eigen::Vector2d;
52 using Eigen::Vector4d;
53 using Eigen::MatrixXd;
54 using Eigen::VectorXd;
56 using namespace Kalman;
90 for(
int l=0;l<size;l++)
91 for(
int c=0;c<size;c++)
109 for(
int l=0;l<size;l++)
110 for(
int c=0;c<size;c++)
139 SetIdentity(P_0,5,4.0);
160 P_0(0,0)=P_init(0,0);
161 P_0(0,1)=P_init(0,1);
162 P_0(0,2)=P_init(0,2);
163 P_0(0,3)=P_init(0,3);
164 P_0(0,4)=P_init(0,4);
166 P_0(1,0)=P_init(1,0);
167 P_0(1,1)=P_init(1,1);
168 P_0(1,2)=P_init(1,2);
169 P_0(1,3)=P_init(1,3);
170 P_0(1,4)=P_init(1,4);
172 P_0(2,0)=P_init(2,0);
173 P_0(2,1)=P_init(2,1);
174 P_0(2,2)=P_init(2,2);
175 P_0(2,3)=P_init(2,3);
176 P_0(2,4)=P_init(2,4);
178 P_0(3,0)=P_init(3,0);
179 P_0(3,1)=P_init(3,1);
180 P_0(3,2)=P_init(3,2);
181 P_0(3,3)=P_init(3,3);
182 P_0(3,4)=P_init(3,4);
184 P_0(4,0)=P_init(4,0);
185 P_0(4,1)=P_init(4,1);
186 P_0(4,2)=P_init(4,2);
187 P_0(4,3)=P_init(4,3);
188 P_0(4,4)=P_init(4,4);
232 A(0,2)=cos(t)*cos(f)*dt;
233 A(0,3)=-sin(t)*cos(f)*v*dt;
234 A(0,4)=cos(t)*(-sin(f))*v*dt;
238 A(1,2)=sin(t)*cos(f)*dt;
239 A(1,3)=cos(t)*cos(f)*v*dt;
240 A(1,4)=sin(t)*(-sin(f))*v*dt;
252 A(3,4)=cos(f)/l*v*dt;
314 SetIdentity(W,5,1.0);
322 SetIdentity(V,3,1.0);
332 double inovation_factor = 5.0;
333 double distortion_y = 0.1;
341 double x_size = inovation_error.norm()*inovation_factor;
342 double y_size = inovation_error.norm()*inovation_factor*distortion_y;
344 double dir = atan2(inovation_error(1),inovation_error(0));
346 cout<<
"miss_associations: "<<miss_associations<<endl;
348 if(miss_associations>0)
370 rot << cos(dir), -sin(dir),
373 Matrix2d cov = rot*eigval*rot.inverse();
452 x_(0) = x(0) + cos(x(3))*cos(x(4))*x(2)*dt;
453 x_(1) = x(1) + sin(x(3))*cos(x(4))*x(2)*dt;
455 x_(3) = x(3) + sin(x(4))*x(2)*dt/l;
double dt
Time interval between measurements.
EKFilter< double, 0, false, false, false >::Matrix Matrix
EKfilter matrix type.
EKFilter< double, 0, false, false, false >::Matrix kMatrix
EKfilter matrix type.
void InitFilter(Vector5d &x_init)
Init filter.
void makeBaseW()
Make process noise sensitivity matrix.
nonholonomic Kalman filter
void makeH()
Make measurement sensitivity matrix.
void SetZero(kMatrix &M, int size)
Set a matrix to zero.
void SetIdentity(kMatrix &M, int size, double value=1)
Set a matrix to identity.
void makeA()
Make the process Jacobian matrix.
Eigen::Matrix< double, 3, 1 > Vector3d
void makeQ()
Make process noise covariance matrix.
Time lt
Time of the last call to the makeCommonProcess function.
void InitFilter(Vector5d &x_init, Matrix5d &P_init)
void makeProcess()
Make process, model iteration.
void makeCommonProcess()
This function is called before all other make something functions.
boost::shared_ptr< nonholonomicEKFilter > nonholonomicEKFilterPtr
EKFilter< double, 0, false, false, false >::Vector kVector
EKFilter< double, 0, false, false, false >::Matrix kMatrix
void makeBaseV()
Make measurement noise sensitivity matrix.
Eigen::Matrix< double, 5, 5 > Matrix5d
EKFilter< double, 0, false, false, false >::Vector Vector
EKfilter vector type.
void makeMeasure()
Make measurement, used when measurement is not possible (i'm not using it now)
Eigen::Matrix< double, 5, 1 > Vector5d
void makeR()
Make measurement noise covariance matrix.