00001
00002
00003 #ifndef SLAM_POINT_INV_DEPTH_FEATURE_HPP
00004 #define SLAM_POINT_INV_DEPTH_FEATURE_HPP
00005
00006 #include "jmath/jblas.hpp"
00007
00008 #include "camera/cameraBarreto.hpp"
00009
00010 #include "slam/feature.hpp"
00011 #include "slam/featureModel.hpp"
00012
00013 namespace jafar {
00014 namespace slam {
00015
00022 class PointInvDepthFeatureModel : public FeatureModel {
00023 public:
00024
00025 jblas::mat J3dPoint;
00026
00027 PointInvDepthFeatureModel();
00028 ~PointInvDepthFeatureModel();
00029
00030
00031 void toFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec& xRes);
00032
00033 void toFrameJac(const jblas::vec& frame_, const jblas::vec& x_);
00034
00035 void fromFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec& xRes);
00036 void fromFrame(jblas::vec const& frame_, jblas::vec const& x_, jblas::vec_range& xRes);
00037
00038 void fromFrameJac(const jblas::vec& frame_, const jblas::vec& x_);
00039
00040 void compute3dPoint(jblas::vec const& x, jblas::vec& pt);
00041 void compute3dPointJac(jblas::vec const& x);
00042 void computeMergeState( const jblas::vec& x_, jblas::vec& mergeX_ , jblas::mat& jac );
00043
00044 };
00045
00051 class BearingPointInvDepthFeatureObserveModel : public FeatureObserveModel {
00052
00053 protected:
00054
00056 double m_id0;
00058 double m_sigmaId0;
00059
00060 PointInvDepthFeatureModel& pointInvDepthFeatureModel;
00061
00062 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00063
00064 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00065
00066 jblas::vec const& computeInnovation(jblas::vec const& z_,
00067 jblas::vec const& zPred_);
00068
00069
00070
00071
00072
00073 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00074
00075 void inverseObservationInSensorFrameJac(Observation const& obs_);
00076
00077
00078 public:
00079
00080 BearingPointInvDepthFeatureObserveModel(PointInvDepthFeatureModel& featureModel_);
00081 ~BearingPointInvDepthFeatureObserveModel();
00082
00083 Observation::ObservationType typeObs() const {return Observation::POINT_BEARING;}
00084
00085 void postInitCovariance(jblas::sym_mat_range & P, jblas::mat const& Jframe);
00086
00091 void setup(double id0 = 0.5, double sigmaId0 = 0.25);
00092
00093 };
00094
00095
00101 class OmniImagePointInvDepthFeatureObserveModel : public FeatureObserveModel {
00102
00103 protected:
00104
00106 double m_id0;
00108 double m_sigmaId0;
00109
00110 jafar::camera::CameraParabolicBarreto camera;
00111
00112 PointInvDepthFeatureModel& pointInvDepthFeatureModel;
00113
00114 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00115
00116 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00117
00118
00119
00120
00121
00122 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00123
00124 void inverseObservationInSensorFrameJac(Observation const& obs_);
00125
00126 public:
00127
00128 OmniImagePointInvDepthFeatureObserveModel(PointInvDepthFeatureModel& featureModel_,
00129 jafar::camera::CameraParabolicBarreto const& camera_);
00130 ~OmniImagePointInvDepthFeatureObserveModel();
00131
00132 Observation::ObservationType typeObs() const {return Observation::POINT_OMNIIMAGE;}
00133
00134 void postInitCovariance(jblas::sym_mat_range & P, jblas::mat const& Jframe);
00135
00140 void setup(double id0 = 0.5, double sigmaId0 = 0.5);
00141
00142 };
00143
00149 class ImagePointInvDepthFeatureObserveModel : public FeatureObserveModel {
00150
00151 protected:
00152
00154 double m_id0;
00156 double m_sigmaId0;
00157
00158 jafar::camera::CameraPinhole camera;
00159
00160 PointInvDepthFeatureModel& pointInvDepthFeatureModel;
00161
00162 jblas::vec const& predictObservationInSensorFrame(const jblas::vec& feature_);
00163
00164 void predictObservationInSensorFrameJac(const jblas::vec& feature_);
00165
00166
00167
00168
00169
00170 jblas::vec inverseObservationInSensorFrame(Observation const& obs_);
00171
00172 void inverseObservationInSensorFrameJac(Observation const& obs_);
00173
00174 public:
00175
00176 ImagePointInvDepthFeatureObserveModel(PointInvDepthFeatureModel& featureModel_, jafar::camera::CameraPinhole const& camera_);
00177
00178 ~ImagePointInvDepthFeatureObserveModel();
00179
00180 Observation::ObservationType typeObs() const {return Observation::POINT_IMAGE;}
00181
00182
00183
00184
00185 void postInitCovariance(jblas::sym_mat_range & P, jblas::mat const& Jfeature);
00186
00191 void setup(double id0 = 0.5, double sigmaId0 = 0.5);
00192
00193
00194 };
00195
00196 }}
00197
00198 #endif // SLAM_POINT_INV_DEPTH_FEATURE_HPP