00001 /* Copyright (C) 2005 Pierre Moisan (Pierre.Moisan@USherbrooke.ca) 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 00018 #ifndef _PFPREDICTIONMODEL_H_ 00019 #define _PFPREDICTIONMODEL_H_ 00020 00021 #include "BufferedNode.h" 00022 #include "PFParticle.h" 00023 00024 namespace RobotFlow { 00025 00026 typedef enum 00027 { 00028 e_PFPM_RandomWalk = 0, 00029 e_PFPM_Unknown 00030 } e_PFPM_type; 00031 00032 // 00033 // Abstract base class for particle filter prediction models 00034 // 00035 class PFPredictionModel : public FD::BufferedNode 00036 { 00037 public: 00038 PFPredictionModel() 00039 : m_modelType(e_PFPM_Unknown) 00040 { 00041 } 00042 00043 PFPredictionModel(e_PFPM_type i_modelType) 00044 : m_modelType(i_modelType) 00045 { 00046 } 00047 00048 PFPredictionModel(e_PFPM_type i_modelType, std::string nodeName, FD::ParameterSet params) 00049 : FD::BufferedNode(nodeName, params), 00050 m_modelType(i_modelType) 00051 { 00052 00053 } 00054 00055 virtual ~PFPredictionModel() 00056 { 00057 00058 } 00059 00060 e_PFPM_type GetType() const 00061 { 00062 return m_modelType; 00063 } 00064 00065 void SetType(e_PFPM_type i_type) 00066 { 00067 m_modelType = i_type; 00068 } 00069 00070 virtual void calculate(int output_id, int count, FD::Buffer &out) = 0; 00071 00072 virtual void Predict(PFParticle *io_sample) = 0; 00073 00074 private: 00075 e_PFPM_type m_modelType; 00076 }; 00077 00078 } 00079 00080 #endif