00001
00002
00003
00004 #ifndef CAJUN_ZONE_PLANNER_H
00005 #define CAJUN_ZONE_PLANNER_H
00006
00007 #include "world_state.H"
00008 #include "rndf.H"
00009 #include "rndf_point.H"
00010
00011 #include "map_grid_publisher.H"
00012 #include "zone_marker.H"
00013 #include "goal_marker.H"
00014 #include "obstacle_marker.H"
00015
00016 #include "search_grid_publisher.H"
00017
00018 #include "wave_gc_oracle.H"
00019
00020 #include "obstacle_free.H"
00021 #include "path_extractor.H"
00022 #include "basic_work_list.H"
00023
00024 #include "uc_planner_param.H"
00025
00026 namespace cajun
00027 {
00028 class zone_planner_t
00029 {
00030 public:
00031 zone_planner_t (world_state_t *ws_, rndf_t const *rndf_,
00032 unsigned zone_id, rndf_point_t *start_rp_,
00033 rndf_point_t *end_rp_);
00034 ~zone_planner_t ();
00035 void generate_path (double tstamp_, path_t &path_, double start_x_,
00036 double start_y_, double orient_);
00037
00038 void mark_obstacles (unsigned zone_id_);
00039
00040 void publish_grids (double tstamp_);
00041 private:
00042
00043 rndf_point_t *m_start_rp;
00044 rndf_point_t *m_end_rp;
00045
00046 double m_goal_x;
00047 double m_goal_y;
00048 double m_goal_orient;
00049
00050
00051 double m_start_x;
00052 double m_start_y;
00053 double m_orient;
00054
00055 double m_cell_size;
00056 world_state_t *m_ws;
00057
00058 rndf_t const *m_rndf;
00059
00060 const uc_planner_param_t *m_uc_param;
00061
00062 unsigned m_zone_id;
00063
00064 map_grid_t m_map_grid;
00065
00066
00067 map_grid_publisher_t *m_map_publisher;
00068
00069 zone_marker_t *m_zone_marker;
00070 goal_marker_t *m_goal_marker;
00071 obstacle_marker_t *m_obstacle_marker;
00072
00073
00074 search_grid_t m_search_grid;
00075 search_grid_publisher_t *m_search_publisher;
00076
00077
00078 work_list_interface_t *m_work_list;
00079
00080
00081 gc_oracle_t *m_gc_oracle;
00082
00083
00084 path_extractor_t *m_path_extractor;
00085
00086 obstacle_free_t *m_obstacle_free;
00087
00088 void compute_goal (rndf_point_t *end_rp_);
00089
00090 void mark_zone_region (unsigned zone_id_);
00091
00092 void mark_goal (rndf_point_t *end_rp_);
00093
00094 void get_non_blocking_start (double &new_x, double &new_y,
00095 double x_, double y_);
00096
00097 void mark_obstacle (obstacle_points_data_t const &obst_);
00098
00099 bool obstacle_in_zone (obstacle_points_data_t const &obst_,
00100 rndf_t::zone_t const &zone);
00101
00102 void parking_properly (path_t &path_);
00103
00104
00105 class filler_t
00106 {
00107 public:
00108 filler_t (map_grid_t *map_grid_) :
00109 m_map_grid (map_grid_), m_cost (0) {}
00110 void set_cost (float cost_) { m_cost = cost_; }
00111
00112 void fill (int x_, int y_, unsigned w_)
00113 {
00114 map_grid_t::iterator_t iter =
00115 m_map_grid->find (x_, y_);
00116
00117 while (w_--)
00118 {
00119 iter->boundary = m_cost;
00120 iter.neighbor (1, 0);
00121 }
00122 }
00123
00124 protected:
00125 map_grid_t * const m_map_grid;
00126
00127 float m_cost;
00128 };
00129
00130
00131 };
00132
00133
00134 };
00135
00136
00137 #endif