Go to the documentation of this file.00001
00012 #ifndef HARDWARE_ESTIMATOR_ODO_HPP_
00013 #define HARDWARE_ESTIMATOR_ODO_HPP_
00014
00015 #include "jafarConfig.h"
00016 #include <boost/thread.hpp>
00017 #include <boost/thread/thread.hpp>
00018 #include <boost/thread/mutex.hpp>
00019 #include <boost/thread/condition_variable.hpp>
00020 #include "jmath/jblas.hpp"
00021 #include "jmath/indirectArray.hpp"
00022 #include "rtslam/hardwareEstimatorAbstract.hpp"
00023 #include "rtslam/hardwareSensorAbstract.hpp"
00024 #include "kernel/keyValueFile.hpp"
00025
00026 namespace jafar {
00027 namespace rtslam {
00028 namespace hardware {
00029 class Position;
00030
00031 class HardwareEstimatorOdo: public HardwareEstimatorAbstract
00032 {
00033 private:
00034 unsigned index_load_;
00035 jblas::mat buffer;
00036 int bufferSize;
00037
00038 boost::mutex mutex_data;
00039 boost::condition_variable cond_data;
00040 boost::condition_variable cond_offline;
00041 int write_position;
00042 int read_position;
00043
00044 double timestamps_correction;
00045 int mode;
00046 RawVec reading;
00047 std::string dump_path;
00048 double realFreq;
00049
00050 boost::thread *preloadTask_thread;
00051 void preloadTask(void);
00052
00053 public:
00054
00055 HardwareEstimatorOdo(double trigger_mode, double trigger_freq, double trigger_shutter, int bufferSize_, int mode = 0, std::string dump_path = ".");
00056 ~HardwareEstimatorOdo();
00057 virtual void start();
00058 void setSyncConfig(double timestamps_correction = 0.0);
00059
00063 jblas::mat_indirect acquireReadings(double t1, double t2);
00064 void releaseReadings() { }
00065 jblas::ind_array instantValues() { return jmath::ublasExtra::ia_set(1,7); }
00066 jblas::ind_array incrementValues() { return jmath::ublasExtra::ia_set(1,1); }
00067
00068 double getFreq() { return realFreq; }
00069
00070 Position loadPosition(unsigned int index_) const;
00071 void loadPosition(unsigned int index_, Position& pos) const;
00072 };
00073
00074 class Position: public kernel::KeyValueFileLoad
00075 {
00076 public:
00077 Position() {}
00078
00079 public:
00080 double m_date;
00081 jblas::vec6 m_mainToBase;
00082
00083 protected:
00084 virtual void loadKeyValueFile(jafar::kernel::KeyValueFile const& keyValueFile);
00085
00086 private:
00087 friend Position HardwareEstimatorOdo::loadPosition(unsigned int index_) const;
00088 friend void HardwareEstimatorOdo::loadPosition(unsigned int index_, Position& pos) const;
00089 };
00090
00091 }}}
00092
00093 #endif
00094