GCOP  1.0
sensorcost.h
Go to the documentation of this file.
00001 #ifndef GCOP_SENSORCOST_H
00002 #define GCOP_SENSORCOST_H
00003 
00004 #include <Eigen/Dense>
00005 #include <iostream>
00006 #include "system.h"
00007 #include "manifold.h"
00008 
00009 namespace gcop {
00010 
00011   using namespace Eigen;
00012   using namespace std;
00013   
00029    //T1 can be the input manifold of sensor which need not be the same as the input of system since we are sharing the same sensor between multiple systems
00030    //typename T1 = T 
00031 
00032   template <typename T = VectorXd, 
00033     int _nx = Dynamic, 
00034     int _nu = Dynamic,
00035     int _np = Dynamic,
00036     typename Tz = VectorXd,
00037     int _nz = Dynamic> class SensorCost {
00038   public:
00039   
00040   typedef Matrix<double, _nx, 1> Vectornd;
00041   typedef Matrix<double, _nu, 1> Vectorcd;
00042   typedef Matrix<double, _np, 1> Vectormd;
00043 
00044   typedef Matrix<double, _nx, _nx> Matrixnd;
00045   typedef Matrix<double, _nx, _nu> Matrixncd;
00046   typedef Matrix<double, _nu, _nx> Matrixcnd;
00047   typedef Matrix<double, _nu, _nu> Matrixcd;
00048   
00049   //  typedef Matrix<double, Dynamic, 1> Vectormd;
00050   typedef Matrix<double, _np, _np> Matrixmd;
00051   typedef Matrix<double, _nx, _np> Matrixnmd;
00052   typedef Matrix<double, _np, _nx> Matrixmnd;
00053   
00054   typedef Matrix<double, _nz, 1> Vectorrd;
00055   typedef Matrix<double, _nz, _nz> Matrixrd;
00056   typedef Matrix<double, _nz, _nx> Matrixrnd;
00057   typedef Matrix<double, _nz, _nu> Matrixrcd;
00058   typedef Matrix<double, _nz, _np> Matrixrmd;
00059 
00065   SensorCost(System<T, _nx, _nu, _np> &sys, Manifold<Tz, _nz>  &Z);
00066 
00083   virtual double L(double t, const Tz &z, const Vectornd &w,
00084                    const Vectormd &p, double h, 
00085                    Vectornd *Lw = 0, Matrixnd* Lww = 0,
00086                    Vectormd *Lp = 0, Matrixmd* Lpp = 0,
00087                    Vectorrd *Lz = 0, Matrixrd* Lzz = 0,
00088                    Matrixmnd *Lpw = 0, Matrixrnd* Lzw = 0, Matrixrmd* Lzp = 0);  
00097   virtual double Lp(const Vectormd &p,
00098                    Vectormd *Lp = 0, Matrixmd *Lpp = 0);
00099 
00100   System<T, _nx, _nu, _np> &sys;  
00101   Manifold<Tz, _nz> &Z;  
00102 };
00103 
00104 
00105   template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 
00106     SensorCost<T, _nx, _nu, _np, Tz, _nz>::SensorCost(System<T, _nx, _nu, _np> &sys, 
00107                                  Manifold<Tz, _nz> &Z) : sys(sys), 
00108                                                          Z(Z) {
00109   }  
00110 
00111   template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 
00112   double SensorCost<T, _nx, _nu, _np, Tz, _nz>::L(double t, const Tz &z, 
00113                                              const Vectornd &w,
00114                                              const Vectormd &p, double h,
00115                                              Vectornd *Lw, Matrixnd* Lww,
00116                                              Vectormd *Lp, Matrixmd* Lpp,
00117                                              Vectorrd *Lz, Matrixrd* Lzz,
00118                                              Matrixmnd *Lpw, Matrixrnd* Lzw, Matrixrmd* Lzp)
00119   {
00120     cout << "[W] Cost:L: unimplemented!" << endl;
00121     return 0;
00122   }
00123 
00124   template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 
00125   double SensorCost<T, _nx, _nu, _np, Tz, _nz>::Lp(const Vectormd &p,
00126                    Vectormd *Lp, Matrixmd *Lpp)
00127   {
00128     return 0;
00129   }
00130 }
00131 
00132 #endif
00133