Go to the documentation of this file.00001
00014 #ifndef SIMUDATA_HPP_
00015 #define SIMUDATA_HPP_
00016
00017 namespace jafar {
00018 namespace rtslam {
00019 namespace simu {
00020
00021
00022
00023 class AppearanceSimu: public rtslam::AppearanceAbstract
00024 {
00025 public:
00026 LandmarkAbstract::geometry_t type;
00027 jblas::vec4 exp;
00028 jblas::vec4 obs;
00029 size_t id;
00030 public:
00031 AppearanceSimu() {}
00032 AppearanceSimu(LandmarkAbstract::geometry_t type, size_t id): type(type), id(id) {}
00033 AppearanceAbstract* clone() { return new AppearanceSimu(*this); }
00034
00035 jblas::vec4 realObs()
00036 {
00037 return obs;
00038 }
00039 };
00040
00041 class FeatureSimu: public rtslam::FeatureAbstract
00042 {
00043 public:
00044 FeatureSimu() {}
00045 FeatureSimu(jblas::vec meas, LandmarkAbstract::geometry_t type, size_t id):
00046 FeatureAbstract(meas.size(), appearance_ptr_t(new AppearanceSimu(type, id))) { measurement.x() = meas; }
00047 FeatureSimu(int size): FeatureAbstract(size, appearance_ptr_t(new AppearanceSimu())) {}
00048 };
00049
00050 typedef boost::shared_ptr<FeatureSimu> featuresimu_ptr_t;
00051
00052 class DescriptorSimu: public rtslam::DescriptorAbstract
00053 {
00054 private:
00055 boost::shared_ptr<AppearanceSimu> appPtr;
00056
00057 public:
00058 bool addObservation(const observation_ptr_t & obsPtr)
00059 {
00060 if (obsPtr->events.updated)
00061 {
00062 appPtr = SPTR_CAST<AppearanceSimu>(obsPtr->observedAppearance);
00063 return true;
00064 } else
00065 return false;
00066 }
00067 bool predictAppearance(const observation_ptr_t & obsPtr)
00068 {
00069 boost::shared_ptr<AppearanceSimu> app_dst = SPTR_CAST<AppearanceSimu>(obsPtr->predictedAppearance);
00070 boost::shared_ptr<AppearanceSimu> app_src = appPtr;
00071 *app_dst = *app_src;
00072
00073 if(app_dst->type == LandmarkAbstract::LINE)
00074 {
00075 app_dst->exp = obsPtr->expectation.x();
00076 }
00077
00078 return true;
00079 }
00080 bool isPredictionValid(const observation_ptr_t & obsPtr) { return true; }
00081 std::ostream& print(std::ostream& os) const { os << appPtr->id; return os; }
00082 };
00083
00084
00085 class RawSimu: public rtslam::RawAbstract {
00086 public:
00087 typedef std::map<size_t,featuresimu_ptr_t> ObsList;
00088 ObsList obs;
00089 virtual RawAbstract* clone() { RawSimu *raw = new RawSimu(); *raw = *this; return raw; }
00090 };
00091
00092
00093 }}}
00094
00095
00096
00097 #endif
00098