00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef LANDMARKANCHOREDHOMOGENEOUSPOINTSLINE_HPP_
00010 #define LANDMARKANCHOREDHOMOGENEOUSPOINTSLINE_HPP_
00011
00012 #include "boost/shared_ptr.hpp"
00013 #include "rtslam/landmarkAbstract.hpp"
00014 #include "rtslam/ahpTools.hpp"
00015 #include "rtslam/ahplTools.hpp"
00016
00021 namespace jafar {
00022 namespace rtslam {
00023
00024 class LandmarkAnchoredHomogeneousPointsLine;
00025 typedef boost::shared_ptr<LandmarkAnchoredHomogeneousPointsLine> ahpl_ptr_t;
00026
00027
00028
00033 class LandmarkAnchoredHomogeneousPointsLine: public LandmarkAbstract {
00034 public:
00035
00036
00040 LandmarkAnchoredHomogeneousPointsLine(const map_ptr_t & mapPtr);
00041
00045 LandmarkAnchoredHomogeneousPointsLine(const simulation_t dummy, const map_ptr_t & mapPtr);
00049 LandmarkAnchoredHomogeneousPointsLine(const map_ptr_t & _mapPtr, const landmark_ptr_t _prevLmk,jblas::ind_array & _icomp);
00050
00051 virtual ~LandmarkAnchoredHomogeneousPointsLine() {
00052
00053 }
00054
00055 virtual std::string typeName() const {
00056 return "Anchored-Homogeneous-Points-Line";
00057 }
00058
00059
00060 static size_t size(void) {
00061 return 11;
00062 }
00063
00064 virtual jblas::ind_array nobs() { return ublasExtra::ia_union(ublasExtra::ia_set(6,7), ublasExtra::ia_set(10,11)); }
00065
00066 virtual size_t mySize() {return size();}
00067
00068 virtual size_t reparamSize() { vec6 v; return v.size();}
00069
00070 virtual jblas::vec3 center() {
00071 vec6 euc = reparametrize_func(state.x());
00072 return (ublas::subrange(euc,0,3)+ublas::subrange(euc,3,6))/2;
00073 }
00074
00075 virtual double uncertainty()
00076 {
00077
00078 double id = state.x()(6);
00079 double ID = 3. * sqrt(state.P()(6,6));
00080 double uncert1 = (id-ID <= 0) ? 1e6 : (1./(id-ID) - 1./id);
00081
00082 id = state.x()(10);
00083 ID = 3. * sqrt(state.P()(10,10));
00084 double uncert2 = (id-ID <= 0) ? 1e6 : (1./(id-ID) - 1./id);
00085
00086 return (uncert1 >= uncert2) ? uncert1 : uncert2;
00087 }
00088
00089 virtual vec reparametrize_func(const vec & lmk) const {
00090 vec6 ret;
00091 vec7 lmk1;
00092 vec7 lmk2;
00093 subrange(lmk1,0,3) = subrange(lmk,0,3);
00094 subrange(lmk1,3,7) = subrange(lmk,3,7);
00095 subrange(lmk2,0,3) = subrange(lmk,0,3);
00096 subrange(lmk2,3,7) = subrange(lmk,7,11);
00097 subrange(ret,0,3) = lmkAHP::ahp2euc(lmk1);
00098 subrange(ret,3,6) = lmkAHP::ahp2euc(lmk2);
00099 return ret;
00100 }
00101
00102 void reparametrize_func(const vec & lmk, vec & lnew, mat & LNEW_lmk) const {
00103 vec7 lmk1;
00104 vec7 lmk2;
00105 vec3 euc1;
00106 vec3 euc2;
00107 mat EUC1_lmk1(3,7);
00108 mat EUC2_lmk2(3,7);
00109 LNEW_lmk.clear();
00110 subrange(lmk1,0,3) = subrange(lmk,0,3);
00111 subrange(lmk1,3,7) = subrange(lmk,3,7);
00112 subrange(lmk2,0,3) = subrange(lmk,0,3);
00113 subrange(lmk2,3,7) = subrange(lmk,7,11);
00114 lmkAHP::ahp2euc(lmk1,euc1,EUC1_lmk1);
00115 lmkAHP::ahp2euc(lmk2,euc2,EUC2_lmk2);
00116 subrange(lnew,0,3) = euc1;
00117 subrange(lnew,3,6) = euc2;
00118 subrange(LNEW_lmk,0,3,0,7) = EUC1_lmk1;
00119 subrange(LNEW_lmk,3,6,0,3) = subrange(EUC2_lmk2,0,3,0,3);
00120 subrange(LNEW_lmk,3,6,7,11) = subrange(EUC2_lmk2,0,3,3,7);
00121 }
00122
00123 virtual bool needToDie();
00124
00125 virtual bool needToReparametrize(DecisionMethod met = ALL){
00126 return false;
00127 }
00128 };
00129 }
00130 }
00131
00132
00133 #endif