Go to the documentation of this file.00001
00008 #ifndef __LandmarkAbstract_H__
00009 #define __LandmarkAbstract_H__
00010
00011
00012
00013 #include "rtslam/rtSlam.hpp"
00014
00015
00016 #include "rtslam/mapAbstract.hpp"
00017 #include "rtslam/mapManager.hpp"
00018 #include "rtslam/mapObject.hpp"
00019 #include "rtslam/descriptorAbstract.hpp"
00020 #include "rtslam/visibilityMap.hpp"
00021
00022 #include "rtslam/parents.hpp"
00023
00024 #include <boost/smart_ptr.hpp>
00025
00026
00027
00028
00029
00030
00031 #define FEJ_EKF 0
00032
00033
00034 namespace jafar {
00035 namespace rtslam {
00036
00037
00038
00039 class ObservationAbstract;
00040
00041
00042
00048 class LandmarkAbstract: public MapObject, public ChildOf<MapManagerAbstract> , public boost::enable_shared_from_this<
00049 LandmarkAbstract>, public ParentOf<ObservationAbstract> {
00050
00051 friend std::ostream& operator <<(std::ostream & s, LandmarkAbstract const & obs);
00052 friend image::oimstream& operator <<(image::oimstream & s, LandmarkAbstract const & lmk);
00053
00054
00055 ENABLE_LINK_TO_PARENT(MapManagerAbstract,MapManager,LandmarkAbstract)
00056 ;
00057
00058 ENABLE_ACCESS_TO_PARENT(MapManagerAbstract,mapManager)
00059 ;
00060
00061 ENABLE_ACCESS_TO_CHILDREN(ObservationAbstract,Observation,observation)
00062 ;
00063
00064 public:
00068 LandmarkAbstract(const map_ptr_t & _mapPtr, const size_t _size, bool freeze_first = false);
00069 LandmarkAbstract(const simulation_t dummy, const map_ptr_t & _mapPtr, const size_t _size, bool freeze_first = false);
00073 LandmarkAbstract(const map_ptr_t & _mapPtr, const landmark_ptr_t & _prevLmk, const size_t _size,jblas::ind_array & _icomp, bool freeze_first = false);
00074
00082 virtual ~LandmarkAbstract();
00083
00084
00085 static IdFactory landmarkIds;
00086 void setId(){id(landmarkIds.getId());}
00087
00088 enum geometry_t {
00089 POINT,
00090 LINE,
00091 PLANE,
00092 ELLIPSE
00093 } ;
00094
00095 enum type_enum{
00096 PNT_EUC, PNT_AH, LINE_AHPL
00097 };
00098 type_enum type;
00099 bool converged;
00100 bool visible;
00101 bool updatable;
00102 enum killed_enum { kNo = 0, kDuplicate, kCellOverflow };
00103 killed_enum killed;
00104
00105 protected:
00106 geometry_t geomType;
00107 public:
00108 std::string categoryName() const {return "LANDMARK";}
00109 geometry_t getGeomType() const {return geomType;}
00110 virtual std::string typeName() const {return "Abstract";}
00111
00112 descriptor_ptr_t descriptorPtr;
00113 VisibilityMap visibilityMap;
00114 Gaussian first_state;
00115
00116 jblas::mat LNEW_lmk;
00117
00118
00119 void reparametrize(const landmark_ptr_t & lmkDestPtr);
00120 void reparametrize(int size, vec &xNew, sym_mat &pNew);
00121 jblas::vec reparametrized() const { return reparametrize_func(state.x()); }
00122 virtual vec reparametrize_func(const vec & lmk) const = 0;
00123 virtual void reparametrize_func(const vec & lmk, vec & lnew, mat & LNEW_lmk) const = 0;
00124
00130 virtual jblas::ind_array nobs() = 0;
00131
00135 virtual size_t mySize() = 0;
00136
00140 virtual size_t reparamSize() = 0;
00141
00145 virtual jblas::vec3 center() = 0;
00146
00150 virtual double uncertainty() = 0;
00151
00152
00153 virtual void setDescriptor(const descriptor_ptr_t & descPtr)
00154 {
00155 descriptorPtr = descPtr;
00156 }
00157
00158 enum DecisionMethod {
00159 ANY,
00160 ALL,
00161 MAJORITY
00162 };
00163
00168 virtual bool needToDie() { return false; }
00169
00173 void destroyDisplay();
00179 void suicide();
00180 #if 0
00181
00184 virtual bool needToReparametrize(DecisionMethod repMethod = ALL);
00185 #endif
00186 virtual void transferInfoLmk(landmark_ptr_t & lmkSourcePtr);
00187
00188
00189 void fillEvents();
00190
00191 unsigned countObserved();
00192
00193 };
00194
00195 }
00196 }
00197
00198 #endif // #ifndef __LandmarkAbstract_H__