00001
00002
00003
00004
00005
00006 #ifndef CAJUN_TASK_PLANNER_H
00007 #define CAJUN_TASK_PLANNER_H
00008
00009 #include "data_type.H"
00010 #include "rndf.H"
00011 #include "world_state.H"
00012
00013 #include "planner_defs.H"
00014
00015 #include <deque>
00016
00017
00018 namespace cajun
00019 {
00020 class mdf_t;
00021
00022 class task_planner_t
00023 {
00024 public:
00025 virtual ~task_planner_t () {}
00028 virtual void set_active () = 0;
00029
00032 virtual path_status_t generate_path (
00033 world_state_t *ws_, path_t &path_, double &p_len_left_,
00034 const path_t &base_path_) = 0;
00035
00037 const path_t* get_path () {return &m_path;}
00038
00040 path_direction_t path_direction () { return m_path_dir;}
00041
00043 path_status_t path_status () { return m_status;}
00045
00046
00048 virtual void set_path_blocked (unsigned p_id_);
00049
00052 void limit_path_speed (unsigned p_id_, double speed_);
00053 void limit_following_path_speed (unsigned p_id_, double speed_);
00054
00056 bool is_active () { return m_active; }
00057
00061 virtual bool get_path_lane_lids (unsigned &sid_,
00062 std::vector<unsigned> &lids_)
00063 {return false;}
00064
00065 struct path_lane_map_t
00066 {
00067 double start_x;
00068 double start_y;
00069
00070 double end_x;
00071 double end_y;
00072
00073 unsigned seg_id;
00074 unsigned lane_id;
00075 };
00076
00077 std::vector<path_lane_map_t> m_path_lane_map;
00078
00079 virtual bool get_path_map_to_lane_lids (
00080 std::vector<path_lane_map_t> &pl_ids_)
00081 {return false;}
00082
00084 virtual bool get_start_lid (unsigned &sid_, unsigned &lid_)
00085 { return false; }
00086
00088 path_turn_info_t get_path_turn_info ()
00089 { return m_turn; }
00090
00092 virtual bool is_task_complete (world_state_t *ws_, double x_,
00093 double y_, double heading_) = 0;
00094
00096 virtual void print_plan () = 0;
00097
00100 void init (mdf_t const *mdf_, rndf_t const *rndf_);
00101
00103 bool reset_base_path () { return m_reset_base_path; }
00104
00105 TP_type_t type () { return m_type; }
00106
00107
00108
00109 virtual bool is_path_tight () { return false; }
00110 virtual bool is_quick_acceleration_path () { return false; }
00111
00112 void print_path_map ();
00113
00114
00115 protected:
00116 mdf_t const *m_mdf;
00117 rndf_t const *m_rndf;
00118 path_t m_path;
00119 bool m_planned_path;
00120 path_status_t m_status;
00121
00122
00123 TP_type_t m_type;
00124 bool m_active;
00125 bool m_complete;
00126 bool m_reset_base_path;
00127
00128
00129 path_direction_t m_path_dir;
00130
00131
00132 path_turn_info_t m_turn;
00133
00134 void update_local_path (const path_t &path_, const path_t &b_path_);
00135
00136 };
00137
00138
00139 typedef std::deque<task_planner_t *> tp_plan_t;
00140
00141 };
00142
00143
00144 #endif