GCOP
1.0
|
00001 #ifndef GCOP_GPS_H 00002 #define GCOP_GPS_H 00003 00004 #include <Eigen/Dense> 00005 #include "sensor.h" 00006 #include "point3d.h" 00007 #include "ins.h" 00008 00009 namespace gcop { 00010 00011 using namespace Eigen; 00012 00013 // typedef Point3dgps<6> FullPoint3dgps; 00014 // typedef Point3dgps<3> AccPoint3dgps; 00015 00024 //Most General Form of Gps 00025 template <typename T, int _nx, int _nu = 3, int _np = Dynamic> class Gps : public Sensor<T, _nx, _nu, _np, Vector3d, 3> { 00026 public: 00027 Gps(): Sensor<T, _nx, _nu, _np, Vector3d, 3> (Rn<3>::Instance()) { 00028 }; 00029 }; 00030 00031 //Specialization1 Using Point3d State 00032 template <int _nu, int _np> class Gps<Point3dState, 6, _nu, _np> : public Sensor<Point3dState, 6, _nu, _np, Vector3d, 3> { 00033 00034 public: 00035 00036 typedef Matrix<double, _nu, 1> Vectorcd; 00037 typedef Matrix<double, _np, 1> Vectormd; 00038 00039 typedef Matrix<double, 3, 6> Matrix36d; 00040 typedef Matrix<double, 3, _nu> Matrixrcd; 00041 typedef Matrix<double, 3, _np> Matrixrmd; 00042 00043 Gps(): Sensor<Point3dState, 6, _nu, _np, Vector3d, 3> (Rn<3>::Instance()) { 00044 00045 sxy = .02; 00046 sz = .02; 00047 00048 this->R(0,0) = sxy*sxy; 00049 this->R(1,1) = sxy*sxy; 00050 this->R(2,2) = sz*sz; 00051 } 00052 00053 00054 bool operator()(Vector3d &y, double t, const Point3dState &x, const Vectorcd &u, 00055 const Vectormd *p = 0, 00056 Matrix36d *dydx = 0, Matrixrcd *dydu = 0, 00057 Matrixrmd *dydp = 0) { 00058 00059 y = x.q;//#TODO Sample from distribution Gaussian (x.q, x.P) or try different distributions 00060 00061 if (dydx){ 00062 dydx->topLeftCorner<3,3>().setIdentity(); 00063 } 00064 00065 return true; 00066 } 00067 00068 double sxy; 00069 double sz; 00070 }; 00071 00072 // Gps::Gps() : 00073 } 00074 00075 #endif