00001 // Copyright (C) 2006 University of Louisiana at Lafayette 00002 // Authors: Christopher Mire 00003 00004 #ifndef CAJUN_DYNAMIC_OBJECT_H 00005 #define CAJUN_DYNAMIC_OBJECT_H 00006 00007 #include "nav_sensor.H" 00008 #include "motion_sensor.H" 00009 #include "sog_sensor.H" 00010 #include "angular_rate_sensor.H" 00011 #include "acceleration_sensor.H" 00012 #include "conf.H" 00013 00014 #define STEER_BUFFER_SIZE 5 00015 00016 namespace cajun 00017 { 00018 class controller_interface_t; 00019 00020 class dynamic_object_t : public sim_world_object_t 00021 { 00022 friend class controller_interface_t; 00023 public: 00024 dynamic_object_t (); 00025 dynamic_object_t (dSpaceID *world_space, object_info_t *object_data, 00026 rndf_tool_t *rndf_tool, access_data_t *access_data_); 00027 ~dynamic_object_t (); 00028 virtual bool update (float curr_time); 00029 virtual void get_data (vector<obstacle_data_t> *&object_info, 00030 vector <obstacle_points_data_t> *&object_points_); 00031 bool read_conf(conf_t &conf_); 00032 void change_controller (int type); 00033 void update_speed (); 00034 void update_steering (float steering, float throttle, 00035 steering_data_t::gear_t gear); 00036 void move_controls (); 00037 void set_static (bool is_static_); 00038 00039 unsigned steering_min; 00040 unsigned steering_max; 00041 unsigned throttle_min; 00042 unsigned throttle_max; 00043 double min_wheel_angle; 00044 double max_wheel_angle; 00045 double avg_wheel_angle; 00046 protected: 00047 bool m_static; 00048 00049 controller_interface_t *m_controller; 00050 nav_sensor_t *m_nav_sensor; 00051 motion_sensor_t *m_motion_sensor; 00052 sog_sensor_t *m_sog_sensor; 00053 angular_rate_sensor_t *m_angular_rate_sensor; 00054 acceleration_sensor_t *m_accel_sensor; 00055 00056 steering_data_t m_steering_buffer[STEER_BUFFER_SIZE]; 00057 unsigned m_steering_counter; 00058 unsigned m_steering_index; 00059 00060 double m_wheel_radius; 00061 double m_wheel_width; 00062 double m_throttle; 00063 double m_steering_pos; 00064 double m_max_omega; 00065 double m_speed; 00066 double m_max_linear_velocity; 00067 double m_throttle_rate; 00068 double m_lever_rate; 00069 00070 steering_data_t m_robotSteering; 00071 steering_data_t::gear_t m_current_gear; 00072 }; 00073 } 00074 #endif