00001 // Copyright (C) 2004 Nitin Jyoti, Arun Pratap, Suresh Golconda ;-) 00002 00003 #ifndef CAJUN_MOTION_SENSOR_OBSERVERS_H 00004 #define CAJUN_MOTION_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 motion_observer_t; 00015 00017 class motion_sensor_t : public components_t 00018 { 00019 #define DELAY_MOTION 0.01 00020 friend class motion_observer_t; 00021 public: 00022 motion_sensor_t (sim_world_object_t *parent, timer_t *timer); 00023 virtual ~motion_sensor_t (); 00024 void update_motion_data (); 00025 00026 double get_heading () { return m_heading; } 00027 double get_roll () { return m_roll; } 00028 double get_pitch () { return m_pitch; } 00029 00030 // inherited functions 00031 void update_position ( dBodyID carb ) { }; 00032 void command ( int cmd, double value ) { }; 00033 void simulate_component (dBodyID carb) { }; 00034 private: 00035 sim_world_object_t *m_robot; 00036 double m_roll; 00037 double m_pitch; 00038 double m_heading; 00039 motion_observer_t * m_motion_observer; 00040 }; 00041 00043 class motion_observer_t : public timer_t::observer_t 00044 { 00045 motion_sensor_t * m_motion_sensor; 00046 public: 00047 motion_observer_t (motion_sensor_t * m, double interval_v); 00048 virtual ~motion_observer_t (); 00049 bool timeout (double currTime); 00050 }; 00051 }; 00052 #endif