00001
00002
00003
00004
00005
00006 #ifndef CAJUN_MAP_GRID_PUBLISHER_H
00007 #define CAJUN_MAP_GRID_PUBLISHER_H
00008
00009
00010 #include "grid_publisher.H"
00011 #include "map_grid.H"
00012
00013
00014 namespace cajun
00015 {
00016
00017
00018 class map_grid_publisher_t : public grid_publisher_t
00019 {
00020 public:
00021 map_grid_publisher_t (unsigned qid_, double cell_size_) :
00022 grid_publisher_t (qid_, cell_size_) {}
00023
00024 void publish (map_grid_t &grid_, double tstamp_)
00025 {
00026 m_tile.tstamp = tstamp_;
00027 grid_.walk (*this);
00028 }
00029 void visit (unsigned x_, unsigned y_, map_grid_t::iterator_t &iter_)
00030 {
00031 if (iter_->goal ||
00032 iter_->boundary == map_cell_t::BLOCKED_CELL ||
00033 iter_->obstacle == map_cell_t::BLOCKED_CELL)
00034 m_tile.cell_value[x_][y_] = m_tile.BLOCKED_CELL;
00035 else
00036 {
00037 float cost = iter_->obstacle + iter_->boundary;
00038
00039 m_publish_tile = true;
00040 m_tile.cell_value[x_][y_] =
00041 unsigned (cost * m_tile.MAX_CELL_VALUE / 7);
00042 }
00043 }
00044 };
00045
00046
00047 };
00048
00049
00050 #endif