Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
landmarkAbstract.hpp
Go to the documentation of this file.
00001 
00008 #ifndef __LandmarkAbstract_H__
00009 #define __LandmarkAbstract_H__
00010 
00011 //#include "kernel/IdFactory.hpp"
00012 
00013 #include "rtslam/rtSlam.hpp"
00014 
00015 // include parents
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 //#include "rtslam/observationAbstract.hpp"
00022 #include "rtslam/parents.hpp"
00023 
00024 #include <boost/smart_ptr.hpp>
00025 
00026 
00027 /*
00028  * STATUS: testing purpose
00029  * Use first-estimate-jacobian for euclidean landmarks
00030  */
00031 #define FEJ_EKF 0
00032 
00033 
00034 namespace jafar {
00035   namespace rtslam {
00036 
00037 
00038     // Forward declarations of children
00039     class ObservationAbstract;
00040 //    class MapManagerAbstract;
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         // define the function linkToParentMapManager().
00055            ENABLE_LINK_TO_PARENT(MapManagerAbstract,MapManager,LandmarkAbstract)
00056         ;
00057         // define the functions mapManagerPtr() and mapManager().
00058       ENABLE_ACCESS_TO_PARENT(MapManagerAbstract,mapManager)
00059         ;
00060         // define the type ObservationList, and the function observationList().
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         //Reparametrize old Landmarks into new ones
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         // Create a landmark descriptor
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__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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