00001 // Copyright (C) 2006 University of Louisiana at Lafayette 00002 // Authors: Christopher Mire 00003 00004 #ifndef CAJUN_SIM_WORLD_H 00005 #define CAJUN_SIM_WORLD_H 00006 00007 #include "simulated_object.H" 00008 #include "non_simulated_object.H" 00009 #include "static_object.H" 00010 #include "mesh_object.H" 00011 #include "proj_util.H" 00012 #include "sim_util.H" 00013 00014 namespace cajun 00015 { 00016 class sim_world_t 00017 { 00018 #define STEP_HIST_SIZE 4 00019 public: 00020 sim_world_t (char const *obj_file, char const *rndf_file, 00021 bool no_sleep, proj_t *proj, char const *lane_dir_, 00022 bool pub_pt_, bool pub_obj_); 00023 ~sim_world_t (); 00024 void start_world (); 00025 private: 00026 void read_object_file (char const *filename); 00027 bool read_object_file_v1 (char const *filename); 00028 bool read_object_file_v2 (char const *filename); 00029 void add_object (object_info_t *obj_info); 00030 double get_avg_step_time (); 00031 void check_collisions (); 00032 void remove_collision_joints (); 00033 static void collision_callback (void *data, dGeomID o1, dGeomID o2); 00034 sim_world_object_t *m_sim_object; 00035 std::vector <sim_world_object_t *> m_objects; 00036 char const *m_object_file; 00037 00038 double m_step_increment; 00039 double m_step_hist[STEP_HIST_SIZE]; 00040 unsigned m_step_hist_counter; 00041 double m_current_time; 00042 unsigned m_sleep_time; 00043 double m_prev_time; 00044 double m_play_value; 00045 bool m_no_sleep; 00046 00047 sim_time_data_t m_sim_time; 00048 std::vector <obstacle_data_t> *obstacle_data_list; 00049 std::vector <obstacle_points_data_t> *obstacle_point_list; 00050 00051 access_data_t *m_access_data; 00052 playback_control_data_t m_playback_control_data; 00053 00054 dGeomID m_ground; 00055 static dJointGroupID m_contact_group; 00056 static dWorldID m_world_body; 00057 dSpaceID m_world_space; 00058 00059 rndf_tool_t *m_rndf_tool; 00060 rndf_t *m_rndf; 00061 char const *m_lane_dir; 00062 00063 bool m_publish_points; 00064 bool m_publish_objects; 00065 }; 00066 } 00067 #endif