00001 // Copyright (C) 2004 Nitin Jyoti, Arun Pratap, Suresh Golconda ;-) 00002 00003 #ifndef CAJUN_SOG_SENSOR_OBSERVERS_H 00004 #define CAJUN_SOG_SENSOR_OBSERVERS_H 00005 00006 #include "timer.H" 00007 #include "data_logger.H" 00008 #include "queue_generator.H" 00009 #include "components.H" 00010 #include "sim_world_object.H" 00011 00012 namespace cajun 00013 { 00014 class sog_observer_t; 00015 00017 class sog_sensor_t : public components_t 00018 { 00019 #define DELAY_SOG 0.01//dont need more accurate SOG 00020 friend class sog_observer_t; 00021 public: 00022 sog_sensor_t (sim_world_object_t *parent, timer_t *timer); 00023 virtual ~sog_sensor_t (); 00024 sog_data_t * update_sog_data (); 00025 double get_sog (); 00026 00027 // inherited functions 00028 void update_position (dBodyID carb) {}; 00029 void command (int cmd, double value) {}; 00030 void simulate_component (dBodyID carb) {}; 00031 private: 00032 sim_world_object_t * m_robot; 00033 sog_data_t m_sog_data; 00034 sog_observer_t * m_sog_observer; 00035 }; 00036 00038 class sog_observer_t : public timer_t::observer_t 00039 { 00040 public: 00041 sog_observer_t ( sog_sensor_t * m, double interval_v); 00042 virtual ~sog_observer_t ( ); 00043 bool timeout(double currTime); 00044 private: 00045 sog_sensor_t *m_sog_sensor; 00046 }; 00047 }; 00048 #endif