Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
hardwareSensorMti.hpp
Go to the documentation of this file.
00001 
00012 #ifndef HARDWARE_SENSOR_MTI_HPP_
00013 #define HARDWARE_SENSOR_MTI_HPP_
00014 
00015 #include "jafarConfig.h"
00016 
00017 #ifdef HAVE_MTI
00018 #include <MTI-clients/MTI.h>
00019 #endif
00020 
00021 #include <boost/thread.hpp>
00022 #include <boost/thread/thread.hpp>
00023 #include <boost/thread/mutex.hpp>
00024 
00025 #include "jmath/jblas.hpp"
00026 #include "jmath/indirectArray.hpp"
00027 
00028 #include "rtslam/hardwareSensorAbstract.hpp"
00029 
00030 
00031 
00032 namespace jafar {
00033 namespace rtslam {
00034 namespace hardware {
00035 
00036   class HardwareSensorMti: public HardwareSensorProprioAbstract
00037   {
00038     private:
00039 #ifdef HAVE_MTI
00040       MTI *mti;
00041 #endif
00042       
00043       std::string dump_path;
00044       double realFreq;
00045       double last_timestamp;
00046       kernel::LoggerTask *loggerTask;
00047 
00048       boost::thread *preloadTask_thread;
00049       void preloadTask(void);
00050 
00051       unsigned mti_count;
00052       double init_ts1, init_ts2;
00053     
00054     public:
00055       
00056       HardwareSensorMti(kernel::VariableCondition<int> *condition, std::string device, double trigger_mode,
00057         double trigger_freq, double trigger_shutter, int bufferSize_, Mode mode = mOnline, std::string dump_path = ".", kernel::LoggerTask *loggerTask = NULL);
00058       ~HardwareSensorMti();
00059       virtual void start();
00060       virtual void stop();
00061       virtual bool join(int timed_ms = -1);
00062       virtual double getLastTimestamp() { boost::unique_lock<boost::mutex> l(mutex_data); return last_timestamp; }
00063       virtual void showInfos()
00064       {
00065         boost::unique_lock<boost::mutex> l(mutex_data);
00066         double first = last_timestamp-mti_count*10e-3;
00067         std::cout << "MTI: delay between " << (first-init_ts2)*1000 << " and " << (first-init_ts1)*1000 << " milliseconds." << std::endl;
00068       }
00069       void setSyncConfig(double timestamps_correction = 0.0/*, bool tightly_synchronized = false, double tight_offset*/);
00070       
00074       jblas::ind_array instantValues() { return jmath::ublasExtra::ia_set(1,10); }
00075       jblas::ind_array incrementValues() { return jmath::ublasExtra::ia_set(1,1); }
00076 
00077       double getFreq() { return realFreq; } // trigger freq
00078   };
00079 
00080 }}}
00081 
00082 #endif
00083 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:26 for Jafar by doxygen 1.7.6.1
LAAS-CNRS