GCOP
1.0
|
00001 #ifndef GCOP_SENSOR_H 00002 #define GCOP_SENSOR_H 00003 00004 #include <Eigen/Dense> 00005 #include <iostream> 00006 #include "manifold.h" 00007 00008 namespace gcop { 00009 00010 using namespace Eigen; 00011 00020 template <typename T = VectorXd, 00021 int _nx = Dynamic, 00022 int _nu = Dynamic, 00023 int _np = Dynamic, 00024 typename Tz = VectorXd, 00025 int _nz = Dynamic> class Sensor { 00026 public: 00027 00028 typedef Matrix<double, _nx, 1> Vectornd; 00029 typedef Matrix<double, _nu, 1> Vectorcd; 00030 typedef Matrix<double, _np, 1> Vectormd; 00031 00032 typedef Matrix<double, _nx, _nx> Matrixnd; 00033 typedef Matrix<double, _nx, _nu> Matrixncd; 00034 typedef Matrix<double, _nu, _nx> Matrixcnd; 00035 typedef Matrix<double, _nu, _nu> Matrixcd; 00036 00037 typedef Matrix<double, _np, _np> Matrixmd; 00038 typedef Matrix<double, _nx, _np> Matrixnmd; 00039 typedef Matrix<double, _np, _nx> Matrixmnd; 00040 00041 typedef Matrix<double, _nz, 1> Vectorrd; 00042 typedef Matrix<double, _nz, _nz> Matrixrd; 00043 typedef Matrix<double, _nz, _nx> Matrixrnd; 00044 typedef Matrix<double, _nz, _nu> Matrixrcd; 00045 typedef Matrix<double, _nz, _np> Matrixrmd; 00046 00047 Sensor(Manifold<Tz, _nz> &Z); 00048 00061 virtual bool operator()(Tz &y, double t, const T &x, const Vectorcd &u, 00062 const Vectormd *p = 0, 00063 Matrixrnd *dydx = 0, Matrixrcd *dydu = 0, 00064 Matrixrmd *dydp = 0); 00065 00066 Manifold<Tz, _nz> &Z; 00067 Matrixrd R; 00068 00069 }; 00070 00071 00072 template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 00073 Sensor<T, _nx, _nu, _np, Tz, _nz>::Sensor(Manifold<Tz, _nz> &Z) : Z(Z) { 00074 if (_nz == Dynamic) { 00075 R.resize(Z.n, Z.n); 00076 } 00077 R.setIdentity(); 00078 } 00079 00080 template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 00081 bool Sensor<T, _nx, _nu, _np, Tz, _nz>::operator()(Tz &y, 00082 double t, const T &x, const Vectorcd &u, 00083 const Vectormd *p, 00084 Matrixrnd *dydx, Matrixrcd *dydu, 00085 Matrixrmd *dydp) { 00086 std::cout << "[W] Sensor::(): unimplemented! Subclasses should override." << std::endl; 00087 return false; 00088 } 00089 } 00090 00091 #endif 00092