Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
gpssimu.hpp
00001 
00002 #ifndef DDF_GPSSIMU_HPP
00003 #define DDF_GPSSIMU_HPP
00004 
00005 #include "ddfsimu/sensorsimu.hpp"
00006 #include "ddfsimu/accelmotion.hpp"
00007 #include "ddf/tools.hpp"
00008 
00009 namespace jafar
00010 {
00011   namespace ddfsimu
00012   {
00013 
00017     template<typename T_OBS>
00018     class GPSSimu : public SensorSimu<T_OBS>
00019     {
00020     public:
00021       using T_OBS::Hx;
00022       using SensorSimu<T_OBS>::GetProcTime;
00023       using SensorSimu<T_OBS>::GetMeasureSize;
00024       using SensorSimu<T_OBS>::GetID;
00025       using SensorSimu<T_OBS>::GetName;
00026    
00027       GPSSimu(unsigned short x_size, unsigned short z_size, bool use_speed_model): SensorSimu<T_OBS>(x_size, z_size)
00028       {
00029         this->m_type_name = SENSOR_GPS;
00030         //m_name = SENSOR_DESCRIPTION[m_type];
00031   
00032         JFR_PRECOND(z_size <= 3, ">3");
00033     
00034         // init H
00035         Hx.clear();
00036   
00037         if(use_speed_model){
00038           Hx(0, 0) = 1.;
00039           if(z_size > 1) Hx(1, 2) = 1.;
00040           if(z_size > 2) Hx(2, 4) = 1.;
00041         }
00042         else {
00043           Hx(0, AccelMotion::SV_X) = 1.;
00044           if(z_size > 1) Hx(1, AccelMotion::SV_Y) = 1.;
00045           if(z_size > 2) Hx(2, AccelMotion::SV_Z) = 1.;
00046         }
00047       }
00048 
00049       void Perceive(VEC const& proc_state, time t)
00050       {
00051         VEC measured_pos(GetMeasureSize());
00052         noalias(measured_pos) = prod(Hx, proc_state);
00053         AddMeasurementWithNoise(t, t+GetProcTime(), measured_pos);
00054       }
00055       void PerceiveRet(VEC const& proc_state, VEC & result) const { noalias(result) = prod(Hx, proc_state); }
00056       void PrintObservationModel(){
00057         JFR_DEBUG("Observation model of sensor " << GetID() << " (" << GetName() << ")\n");
00058         PrettyPrintMatrix(Hx, "Hx");
00059       }
00060     };
00061 
00062     class GPSSimuUncorr : public GPSSimu<Bayesian_filter::Linear_uncorrelated_observe_model>
00063     {
00064     public:
00065       GPSSimuUncorr(unsigned short x_size, unsigned short z_size, bool use_speed_model = false) :
00066         GPSSimu<Bayesian_filter::Linear_uncorrelated_observe_model>(x_size, z_size, use_speed_model){}
00067    
00068       virtual ~GPSSimuUncorr() {}
00069 
00070       void ComputeInformation(VEC const& z, VEC &i, MSYM &I) { compute_information_uncorr(*this, z, i, I); }
00071       void SetSensorModelVar(VEC const& var) { Zv = var; }
00072       void PrintObservationModel()
00073       {
00074         GPSSimu<Bayesian_filter::Linear_uncorrelated_observe_model>::PrintObservationModel();
00075         PrettyPrintVector(Zv, "Zv");
00076       }
00077     };
00078 
00079     class GPSSimuCorr : public GPSSimu<Bayesian_filter::Linear_correlated_observe_model>
00080     {
00081     public:
00082       GPSSimuCorr(unsigned short x_size, unsigned short z_size, bool use_speed_model = false) :
00083         GPSSimu<Bayesian_filter::Linear_correlated_observe_model>(x_size, z_size, use_speed_model){}
00084    
00085       virtual ~GPSSimuCorr() {}
00086 
00087       void ComputeInformation(VEC const& z, VEC &i, MSYM &I) { compute_information_corr(*this, z, m_sp, i, I); }
00088       void SetSensorModelCov(MSYM const& cov) { Z = cov; }
00089       void PrintObservationModel()
00090       {
00091         GPSSimu<Bayesian_filter::Linear_correlated_observe_model>::PrintObservationModel();
00092         PrettyPrintMatrix(Z, "R");
00093       }
00094     };
00095 
00096   } // namespace ddfsimu
00097 } // namespace jafar
00098 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:17 for Jafar by doxygen 1.7.6.1
LAAS-CNRS