GCOP  1.0
flat.h
Go to the documentation of this file.
00001 #ifndef GCOP_FLAT_H
00002 #define GCOP_FLAT_H
00003 
00004 #include "system.h"
00005 
00006 namespace gcop {
00007   
00008   using namespace std;
00009   using namespace Eigen;
00010 
00016   template <typename T, 
00017     int nx = Dynamic, 
00018     int nu = Dynamic,
00019     int np = Dynamic,
00020     int nz = Dynamic,
00021     int _ny = Dynamic> class Flat {
00022     
00023     typedef Matrix<double, nx, 1> Vectornd;
00024     typedef Matrix<double, nu, 1> Vectorcd;
00025     typedef Matrix<double, nx, nx> Matrixnd;
00026     typedef Matrix<double, nx, nu> Matrixncd;
00027     typedef Matrix<double, nu, nx> Matrixcnd;
00028     typedef Matrix<double, nu, nu> Matrixcd;  
00029 
00030     typedef Matrix<double, np, 1> Vectormd;
00031 
00032     typedef Matrix<double, _ny, 1> Vectoryd;
00033 
00034   public:
00042     Flat(System<T, nx, nu, np, nz, _ny> &sys, int ny = _ny, int ox = 1, int ou = 2);
00043     
00050     virtual bool State(T& x, 
00051                        const vector<Vectoryd> &ys);
00052     
00059     virtual bool Control(Vectorcd &u, 
00060                          const vector<Vectormd> &ys);
00061 
00062     System<T, nx, nu, np, nz> &sys;     
00063 
00064     int ny;                            
00065     int ox;                            
00066     int ou;                            
00067   };
00068   
00069   template <typename T, int nx, int nu, int np, int nz, int _ny> 
00070     Flat<T, nx, nu, np, nz, _ny>::Flat(System<T, nx, nu, np, nz> &sys, int ny, int ox, int ou) : 
00071     sys(sys), ny(_ny != Dynamic ? _ny : ny), ox(ox), ou(ou) {
00072     assert(ny > 0);
00073     assert(ox > 0);
00074     assert(ou > 0);
00075   }
00076 
00077   template <typename T, int nx, int nu, int np, int nz, int _ny> 
00078     bool Flat<T, nx, nu, np, nz, _ny>::State(T &x,
00079                                              const vector<Vectoryd> &ys) {
00080     cout << "[W] Flat::State: unimplemented! Subclasses should override." <<endl;
00081     return false;
00082   } 
00083 
00084   template <typename T, int nx, int nu, int np, int nz, int _ny> 
00085     bool Flat<T, nx, nu, np, nz, _ny>::Control(Vectorcd &u,
00086                                                const vector<Vectoryd> &ys) {
00087     cout << "[W] Flat::Control: unimplemented! Subclasses should override." <<endl;
00088     return false;
00089   } 
00090 }
00091 
00092 #endif