Go to the documentation of this file.00001
00012 #ifndef MAPABSTRACT_HPP_
00013 #define MAPABSTRACT_HPP_
00014
00015 #include "kernel/dataLog.hpp"
00016 #include "jmath/jblas.hpp"
00017 #include "rtslam/rtSlam.hpp"
00018
00019 #include "rtslam/gaussian.hpp"
00020 #include "rtslam/kalmanFilter.hpp"
00021 #include "rtslam/parents.hpp"
00022 #include "rtslam/worldAbstract.hpp"
00023
00024 namespace jafar {
00029 namespace rtslam {
00030
00031
00032
00033 class RobotAbstract;
00034 class LandmarkAbstract;
00035 class MapManagerAbstract;
00036 class ObservationFactory;
00037
00043 class MapAbstract: public ObjectAbstract, public ChildOf<WorldAbstract>,
00044 public boost::enable_shared_from_this<MapAbstract>,
00045 public ParentOf<RobotAbstract> , public ParentOf<MapManagerAbstract>, public kernel::DataLoggable {
00046
00047 ENABLE_LINK_TO_PARENT(WorldAbstract,World,MapAbstract);
00048 ENABLE_ACCESS_TO_PARENT(WorldAbstract,world);
00049
00050 ENABLE_ACCESS_TO_CHILDREN(RobotAbstract,Robot,robot);
00051 ENABLE_ACCESS_TO_CHILDREN(MapManagerAbstract,MapManager,mapManager);
00052
00053 public:
00063 friend std::ostream& operator <<(std::ostream & s, MapAbstract const & map);
00064
00065 public:
00066
00067
00071 MapAbstract(size_t _max_size);
00072 MapAbstract(const ekfInd_ptr_t & ekfPtr);
00073
00077 virtual ~MapAbstract() {
00078 }
00079
00080 virtual std::string categoryName() const {
00081 return "MAP";
00082 }
00083
00084 Gaussian state;
00085
00089 ekfInd_ptr_t filterPtr;
00090
00091
00095 size_t max_size;
00096 size_t current_size;
00097 jblas::vecb used_states;
00098
00104 inline jblas::ind_array ia_used_states() {
00105 jblas::ind_array res;
00106 res = jmath::ublasExtra::ia_set(used_states);
00107 return res;
00108 }
00109
00110
00111 jblas::vec & x();
00112 jblas::sym_mat & P();
00113 double & x(size_t i);
00114 double & P(size_t i, size_t j);
00115
00120 inline std::size_t unusedStates() const {
00121 return max_size - current_size;
00122 }
00123
00124
00129 inline bool unusedStates(const size_t N) const {
00130 return (unusedStates() >= N);
00131 }
00132
00140 jblas::ind_array reserveStates(const std::size_t _size);
00141
00146 jblas::ind_array convertStates(const jblas::ind_array & _ia,const std::size_t N,jblas::ind_array & _icomp);
00147
00153 void liberateStates(const jblas::ind_array & _ia);
00154
00155 void clear();
00156 void fillSeq();
00157 void fillDiag();
00158 void fillDiagSeq();
00159 void fillRndm();
00160
00161 virtual void writeLogHeader(kernel::DataLogger& log) const;
00162 virtual void writeLogData(kernel::DataLogger& log) const;
00163
00164 private:
00165
00166
00167 };
00168
00169 }
00170 }
00171
00172 #endif
00173