00001
00002
00003 #ifndef SLAM_POINT_FEATURE_HPP
00004 #define SLAM_POINT_FEATURE_HPP
00005
00006 #include "jmath/jblas.hpp"
00007
00008 #include "camera/cameraPinhole.hpp"
00009 #include "camera/cameraBarreto.hpp"
00010
00011 #include "slam/eulerTools.hpp"
00012 #include "slam/feature.hpp"
00013 #include "slam/featureModel.hpp"
00014 #include "slam/bearingOnlyFeature.hpp"
00015
00016 namespace jafar {
00017 namespace slam {
00018
00023 class PointFeatureModel : public FeatureModel {
00024
00025 public:
00026
00027 PointFeatureModel();
00028 ~PointFeatureModel();
00029
00030 void toFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec& xRes);
00031
00032 void toFrameJac(const jblas::vec& frame_, const jblas::vec& x_);
00033
00034 void fromFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec& xRes);
00035 void fromFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec_range& xRes);
00036
00037 void fromFrameJac(const jblas::vec& frame_, const jblas::vec& x_);
00038 void computeMergeState( const jblas::vec& x_, jblas::vec& mergeX_, jblas::mat& jac );
00039
00040 };
00041
00046 class CartesianPointFeatureObserveModel : public FeatureObserveModel {
00047
00048 public:
00049
00050 CartesianPointFeatureObserveModel(PointFeatureModel& featureModel_);
00051
00052 ~CartesianPointFeatureObserveModel();
00053
00054 Observation::ObservationType typeObs() const {return Observation::POINT_CARTESIAN;}
00055
00056 protected:
00057
00058 jblas::vec const& predictObservationInSensorFrame(jblas::vec const& feature_);
00059
00060 void predictObservationInSensorFrameJac(jblas::vec const& feature_);
00061
00062
00063
00064
00065
00066 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00067
00068 void inverseObservationInSensorFrameJac(Observation const& obs_);
00069
00070 };
00071
00076 class PolarPointFeatureObserveModel : public FeatureObserveModel {
00077
00078 public:
00079
00080 PolarPointFeatureObserveModel(PointFeatureModel& featureModel_);
00081
00082 ~PolarPointFeatureObserveModel();
00083
00084 Observation::ObservationType typeObs() const {return Observation::POINT_POLAR;}
00085
00086 void setNoiseValues(double rhoUnitStdDev_, double thetaStdDev_, double phiStdDev_);
00087
00088 void computeSensorR(Observation const& obs);
00089
00090 protected:
00091
00093 double rhoUnitStdDev;
00094
00095 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00096
00097 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00098
00099 jblas::vec const& computeInnovation(jblas::vec const& z_,
00100 jblas::vec const& zPred_);
00101
00102
00103
00104
00105
00106 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00107
00108 void inverseObservationInSensorFrameJac(Observation const& obs_);
00109
00110
00111 };
00112
00117 class BearingPointFeatureObserveModel : public BearingOnlyFeatureObserveModel {
00118
00119 public:
00120
00122 double alpha;
00124 double beta;
00125
00126 BearingPointFeatureObserveModel(PointFeatureModel& featureModel_, double alpha_ = 0.2, double kSigma_ = 1.0);
00127
00128 ~BearingPointFeatureObserveModel();
00129
00130 jblas::vec const& computeInnovation(jblas::vec const& z_,
00131 jblas::vec const& zPred_);
00132
00133 Observation::ObservationType typeObs() const {return Observation::POINT_BEARING;}
00134
00135 virtual void initStateInSensorFrame(InitFeature& feature_,
00136 Observation const& obs_,
00137 double dMin_, double dMax_);
00138
00139 protected:
00140
00141 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00142
00143 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00144
00145 bool doUpdateInitStateInSensorFrame(jblas::vec const& closestMemberState, Observation const& obsRef);
00146
00147 };
00148
00153 class ImagePointFeatureObserveModel : public BearingOnlyFeatureObserveModel {
00154
00155 protected:
00156
00157 jafar::camera::CameraPinhole camera;
00158
00159 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00160
00161 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00162
00163 double computeBaselineInSensorFrame(jblas::vec_range const& deltaPose, Observation const& obsRef) const;
00164
00165 public:
00166
00168 double alpha;
00170 double beta;
00171
00172 ImagePointFeatureObserveModel(PointFeatureModel& featureModel_,
00173 jafar::camera::CameraPinhole const& camera_,
00174 double alpha_ = 0.2, double kSigma_ = 1.0);
00175
00176 ~ImagePointFeatureObserveModel();
00177
00178 Observation::ObservationType typeObs() const {return Observation::POINT_IMAGE;}
00179
00180 void initStateInSensorFrame(InitFeature& feature_,
00181 Observation const& obs_,
00182 double dMin_, double dMax_);
00183
00184 };
00185
00190 class StereoImagePointFeatureObserveModel : public FeatureObserveModel {
00191
00192 protected:
00193
00194 jafar::camera::StereoBench stereoBench;
00195
00196 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00197
00198 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00199
00200
00201
00202
00203
00204 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00205
00206 void inverseObservationInSensorFrameJac(Observation const& obs_);
00207
00208
00209 public:
00210
00211 StereoImagePointFeatureObserveModel(PointFeatureModel& featureModel_,
00212 jafar::camera::StereoBench const& stereoBench_);
00213
00214 ~StereoImagePointFeatureObserveModel();
00215
00216 Observation::ObservationType typeObs() const {return Observation::POINT_STEREOIMAGE;}
00217
00218 };
00219
00224 class OmniImagePointFeatureObserveModel : public BearingOnlyFeatureObserveModel {
00225
00226 protected:
00227
00228 jafar::camera::CameraParabolicBarreto camera;
00229
00230 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00231
00232 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00233
00234 double computeBaselineInSensorFrame(jblas::vec_range const& deltaPose, Observation const& obsRef) const;
00235
00236 public:
00237
00239 double alpha;
00241 double beta;
00242
00243 OmniImagePointFeatureObserveModel(PointFeatureModel& featureModel_,
00244 jafar::camera::CameraParabolicBarreto const& camera_);
00245
00246 ~OmniImagePointFeatureObserveModel();
00247
00248 Observation::ObservationType typeObs() const {return Observation::POINT_OMNIIMAGE;}
00249
00250 void setBoParam(double alpha_ = 0.15, double kSigma_ = 1.0);
00251
00252 void initStateInSensorFrame(InitFeature& feature_,
00253 Observation const& obs_,
00254 double dMin_, double dMax_);
00255
00256 };
00257
00258
00259
00260 }
00261 }
00262
00263
00264 #endif // SLAM_POINT_FEATURE_HPP