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

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