00001 // Copyright (C) 2006 University of Louisiana at Lafayette 00002 // Authors: Christopher Mire 00003 00004 #ifndef CAJUN_DRIVE_SENSOR_OBSERVERS_H 00005 #define CAJUN_DRIVE_SENSOR_OBSERVERS_H 00006 00007 #include "simulated_object.H" 00008 #include "queue_generator.H" 00009 #include "data_logger.H" 00010 #include "components.H" 00011 00012 namespace cajun 00013 { 00014 class drive_observer_t; 00015 class simulated_object_t; 00016 00018 class drive_sensor_t : public components_t 00019 { 00020 #define DELAY_DRIVE 0.01 00021 friend class drive_observer_t; 00022 public: 00023 drive_sensor_t (simulated_object_t *parent, timer_t *timer); 00024 virtual ~drive_sensor_t (); 00025 void get_drive_data (); 00026 // inherited functions 00027 void update_position (dBodyID carb); 00028 void command (int cmd, double value); 00029 void simulate_component (dBodyID carb); 00030 drive_data_t m_drive_data; 00031 private: 00032 simulated_object_t *m_robot; 00033 drive_observer_t *m_drive_observer; 00034 }; 00035 00037 class drive_observer_t : public timer_t::observer_t 00038 { 00039 public: 00040 drive_observer_t (drive_sensor_t * m, double interval_v); 00041 virtual ~drive_observer_t (); 00042 bool timeout (double currTime); 00043 private: 00044 drive_sensor_t *m_drive_sensor; 00045 }; 00046 }; 00047 #endif