00001
00002
00003
00004 #ifndef CAJUN_PLANNER_H
00005 #define CAJUN_PLANNER_H
00006
00007 #include "data_type.H"
00008 #include "rndf.H"
00009 #include "world_state.H"
00010
00011 #include "path_generator.H"
00012 #include "path_verifier.H"
00013 #include "traffic_verifier.H"
00014
00015 #include "base_path_provider.H"
00016 #include "task_plan_handler.H"
00017 #include "mission_handler.H"
00018
00019 #include "uc_planner_param.H"
00020 #include "planner_defs.H"
00021
00022 #include "state_machine.H"
00023 #include "rndf_point.H"
00024
00025 #include <deque>
00026
00027
00028 namespace cajun
00029 {
00030
00031 class mdf_t;
00032 class task_planner_t;
00033
00034 class planner_t
00035 {
00036 public:
00037 planner_t (mdf_t const *mdf_, rndf_t const *rndf_,
00038 world_state_t *ws_);
00039
00040 ~planner_t ();
00041
00042 void init ();
00043
00044 void get_steering_path (path_data_t &d_, path_data_t &base_path_);
00045
00046 path_turn_info_t get_path_turn_info ();
00047
00048 bool is_finished () { return m_mission_handler->is_finished ();}
00049
00050 void get_mission_status (mission_status_data_t &ms_);
00051
00052 void get_pres_lid (unsigned &sid_, unsigned &lid_);
00053
00054 protected:
00055 void get_path (std::deque <task_planner_t *> &task_plan_,
00056 path_t &path, const path_t &b_path);
00057
00058 bool get_path_direction (std::deque<task_planner_t *> &task_plan_);
00059
00060 void update_path_flags (path_data_t &path_data_,
00061 path_data_t &b_path_data_);
00062
00063 bool update_waypoints_reached (double x_, double y_);
00064
00065 bool ready_to_handle_blocked_lane (const path_t &b_path,
00066 unsigned blk_tp_ind_);
00067 const uc_planner_param_t *m_uc_param;
00068
00069
00070
00071
00072 double m_passing_lane_confirm_tstamp;
00073
00074
00075 mdf_t const *m_mdf;
00076 rndf_t const *m_rndf;
00077 path_generator_t *m_path_generator;
00078
00079 path_verifier_t *m_path_verifier;
00080 traffic_verifier_t *m_traffic_verifier;
00081
00082 base_path_provider_t *m_base_path_provider;
00083 task_plan_handler_t *m_tp_handler;
00084 mission_handler_t *m_mission_handler;
00085
00086 std::deque<task_planner_t *> m_plan;
00087 mission_plan_t m_mission_plan;
00088
00089 world_state_t *m_world_state;
00090
00091
00092 state_machine_t *m_sm;
00093
00094
00095 bool m_first_iteration;
00096
00097 void update_task_planner_status (double x_, double y_,
00098 double heading_);
00099
00100 void update_planner_state ();
00101
00102 void set_final_speed_limit (path_t &path_);
00103
00104 void get_base_path (path_t &path_);
00105
00106 void reset_path_speed (path_t &path_);
00107
00108 void adjust_path_speeds (path_t &path, const path_t &b_path);
00109
00110 void limit_path_speed (std::deque <task_planner_t *> &task_plan_,
00111 unsigned tp_ind_, unsigned path_ind_,
00112 double speed_);
00113
00114 bool analyze_path (path_t &b_path_);
00115
00116 void convoy_dynamic_object (blocked_lane_data_t &blk_data,
00117 unsigned blk_tp_ind, unsigned path_blk_index,
00118 double blk_speed);
00119 double dis_along_path (double x1_, double y1_,
00120 unsigned tp_ind_, unsigned path_ind_);
00121 void print_plan (
00122 std::deque<rndf_t::waypoint_id_t> const &detail_plan_,
00123 std::deque<rndf_t::waypoint_id_t> const &filtered_plan_);
00124
00125 void update_plan (bool could_be_at_start_shoot_ = false);
00126
00127 double distance_from_static_blk (
00128 std::deque<task_planner_t *> const &plan_,
00129 blocked_lane_data_t const &blk_,
00130 unsigned tp_ind_, unsigned path_ind_);
00131
00132 double compute_convoy_dis (double speed_);
00133
00134 bool convoy_for_dyn_blk (unsigned blk_tp_ind,
00135 blocked_lane_data_t const &blk);
00136
00137 };
00138
00139 };
00140
00141
00142 #endif