Grid.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00032 
00033 
00034 // #ifndef __LOCAL_GRID_H
00035 // #define __LOCAL_GRID_H
00036 // 
00037 // #include <assert.h>
00038 // #include <Spaces.h>
00039 // #include <vector>
00040 // #include <math.h>
00041 // #include "localPlanner.h"
00042 // 
00043 // 
00044 // #define INFINITY -1
00045 // 
00046 // using namespace std;
00047 // 
00048 // typedef struct indexes{
00049 // unsigned int i;
00050 // unsigned int j;
00051 // }IndexPoint;
00052 
00060 // class Cell{
00061 //  private:
00062 //   
00063 //   Position      _p;   /**<cell position in meters w.r.t. the center cell*/
00064 //   IndexPoint _inp; /**<cell indeces in matricial rapresentation*/
00065 //   
00066 //   Decimal _side; /**<side size of the cell in meters*/
00067 // 
00068 //   bool _isLRR;    /**<flag; denotes that cell belongs to the LRR*/
00069 //   bool _isFrontier; /**<flag; denotes that cell belongs to the Frontier*/
00070 //   bool _isLSR;    /**<flag; denotes that cell belongs to the LSR*/
00071 //   bool _isPrevExpl; /**<flag; denotes that cell does not belong to the LSR but has already been explored*/
00072 //   bool _isObstacle; /**<flag; denotes that cell is bounded by an obstacle*/
00073 //   /// allowed cells combinations:
00074 //   ///  _isLRR  _isFrontier  _isLSR(CurrExplored)  isPrevExplored  _isObstacle
00075 //   ///1  true   false     true        false       false
00076 //   ///2  false   true     true        false       false
00077 //   ///3  false   false     true        false       false
00078 //   ///4  false   false     true        false       true
00079 //   ///5  false   false     false        true        false 
00080 //   bool _integrity();   /**<check the integrity of flags*/
00081 //   
00082 //   unsigned int _cone; /**<sensor's perception cone the cell belongs to*/
00083 // 
00084 //   Decimal _distVP;       /**<distance from ViewPoint (center) in meters*/
00085 //   Decimal _distLSRBound; /**<distance from closest LSR boundary*/
00086 // 
00087 //   
00088 //  public:
00089 //     
00090 //     ///default constr should be not allowed
00091 //   Cell();
00092 //   ///Decimal constructor
00093 //   Cell(Decimal);
00094 //   ///Copy constructor
00095 //   Cell(const Cell& c);
00096 //   ///= operator
00097 //   Cell operator=(const Cell& c);
00098 //   /*Cell(Position,IndexPoint);*/
00099 //   
00100 // /***************************************************************************************************
00101 // ***********************************        SET FUNCTIONS         ***********************************
00102 // ***************************************************************************************************/
00103 //   
00104 //   ///\brief sets cell position in meters w.r.t. the center cell
00105 //   void setPoint(Position point){
00106 //    _p=point;
00107 //   }
00108 //   
00109 //   ///\brief sets cell indeces in matricial rapresentation
00110 //   void setIndexPoint(IndexPoint index){
00111 //    _inp=index;
00112 //   }
00113 //   
00114 //   ///\brief sets cell side in meters
00115 //   void setSide(Decimal value){
00116 //    _side=value;
00117 //   }
00118 //   
00119 //   ///\brief sets _isLRR flag 
00120 //   void setIsLRR(){
00121 //    _isLRR=true;
00122 //   }
00123 //   
00124 //   ///\brief unset _isFrontier flag 
00125 //   void setIsFrontier(){
00126 //    _isFrontier=true;
00127 //   }
00128 //   
00129 //   ///\brief sets _isLSR flag 
00130 //   void setIsLSR(){
00131 //    _isLSR=true;
00132 //   }
00133 //   
00134 //   ///\brief sets _isPrevExpl flag 
00135 //   void setIsPrevExpl(){
00136 //    _isPrevExpl=true;
00137 //   }
00138 //   
00139 //   ///\brief sets _isObstacle flag 
00140 //   void setIsObstacle(){
00141 //    _isObstacle=true;
00142 //   }
00143 //   
00144 //   ///\brief set appartenence cone
00145 //   void setCone (unsigned int value){
00146 //    _cone=value;
00147 //   }
00148 //   
00149 //   ///\brief sets distance from ViewPoint (center) in meters
00150 //   void setDistVP(Decimal value){
00151 //    _distVP=value;
00152 //   }
00153 //   
00154 //   ///\brief sets distance from closest LSR boundary
00155 //   void  setDistLSRBound(Decimal value){
00156 //    _distLSRBound=value;
00157 //   }
00158 //   
00159 //   
00160 //   ///\brief unset the flag _isLRR
00161 //   void unsetLRR(){
00162 //    _isLRR=false;
00163 //   }
00164 //   
00165 //   ///\brief unset the flag _isFrontier
00166 //   void unsetFrontier(){
00167 //    _isFrontier=false;
00168 //   }
00169 //   
00170 //   ///\brief unset the flag _isLSR
00171 //   void unsetLSR(){
00172 //    _isLSR=false;
00173 //   }
00174 //   
00175 //   ///\brief unset the flag _isPrevExpl
00176 //   void unsetIsPrevExpl(){
00177 //    _isPrevExpl=false;
00178 //   }
00179 //   
00180 //   ///\brief unset the flag _isObstacle
00181 //   void unsetIsObstacle(){
00182 //    _isObstacle=false;
00183 //   }
00184 //   
00185 // /***************************************************************************************************
00186 // ***********************************        GET FUNCTIONS         ***********************************
00187 // ***************************************************************************************************/
00188 //   
00189 //   ///\brief return cell position in meters w.r.t. the center cell
00190 //   Position point(void){
00191 //    return _p;
00192 //   }
00193 //   
00194 //   ///\brief return cell indeces in matricial rapresentation
00195 //   IndexPoint indexPoint(){
00196 //    return _inp;
00197 //   }
00198 //   
00199 //   ///\brief return cell side in meters
00200 //   Decimal side(){
00201 //    return _side;
00202 //   }
00203 //   
00204 //   ///\brief return _isLRR flag 
00205 //   bool isLRR(){
00206 //    return _isLRR;
00207 //   }
00208 //   
00209 //   ///\brief return _isFrontier flag 
00210 //   bool isFrontier(){
00211 //    return _isFrontier;
00212 //   }
00213 //   
00214 //   ///\brief return isLRSR flag 
00215 //   bool isLSR(){
00216 //    return _isLSR;
00217 //   }
00218 //   
00219 //   ///\brief return _isPrevExpl flag 
00220 //   bool isPrevExpl(){
00221 //    return _isPrevExpl;
00222 //   }
00223 //   
00224 //   ///\brief return _isObstacle flag 
00225 //   bool isObstacle(){
00226 //    return _isObstacle;
00227 //   }
00228 //   
00229 //   ///\brief return integrity flag
00230 //   bool integrity(){
00231 //    return ( (_isLRR  && !_isFrontier  && _isLSR  && !_isPrevExpl && !_isObstacle) ||
00232 //      (!_isLRR && _isFrontier   && _isLSR  && !_isPrevExpl && !_isObstacle)||
00233 //      (!_isLRR && !_isFrontier  && _isLSR  && !_isPrevExpl && !_isObstacle) ||
00234 //      (!_isLRR && !_isFrontier  && _isLSR  && !_isPrevExpl && _isObstacle)  ||
00235 //      (!_isLRR && !_isFrontier  && !_isLSR && _isPrevExpl  && !_isObstacle) ||
00236 //      (!_isLRR && !_isFrontier  && !_isLSR && !_isPrevExpl && !_isObstacle) );
00237 //   }
00238 //   
00239 //   ///\brief return appartenence cone
00240 //   unsigned int cone (){
00241 //    return _cone;
00242 //   }
00243 //   
00244 //   ///\brief return distance of current cell from ViewPoint (center) in meters
00245 //   Decimal distVP(){
00246 //    return _distVP;
00247 //   }
00248 //   
00249 //   ///\brief return distance of current cell from closest LSR boundary
00250 //   Decimal distLSRBound(){
00251 //    return _distLSRBound;
00252 //   }
00253 // };
00254 
00262 // class LocalGrid {
00263 //  private:
00264 //   Decimal _resolution;    /**<cells side size in meters*/
00265 //   Decimal _width;         /**<grid width in meters*/
00266 //   Decimal _height;        /**<grid height in meters*/
00267 //   unsigned int _columns; /**<number of grid columns (odds)*/
00268 //   unsigned int _rows;    /**<number of grid rows (odds)*/
00269 //   Position  _center;        /**<center cell coordinates w.r.t. the absolute frame*/
00270 //   Position  _lowCorner;     /**<lower left cell coordinates w.r.t. the absolute frame*/
00271 // 
00272 //   vector<Cell> _board; /**<matricial rapresentation of the grid*/
00273 //   
00274 //   bool _firstUpdate;
00275 //   bool _firstBound;
00276 // 
00277 //   ///\brief computes the number of columns in the grid
00278 //   ///@param wid grid width in meters
00279 //   ///@param res cells side size in meters
00280 //   void compCol(Decimal wid, Decimal res);
00281 //   
00282 //   ///\brief computes the number of rows in the grid
00283 //   ///@param hei grid height in meters
00284 //   ///@param res cells side size in meters
00285 //   void compRow(Decimal hei, Decimal res);
00286 // 
00287 //   ///\brief update the matricial rapresentation of the grid
00288 //   ///@param lsr Local Safe Region
00289 //   void updateBoard(LSR lsr);
00290 // 
00291 //   ///\brief finds the appartenence cone of a cell
00292 //   void findCone();
00293 // 
00294 //   ///\brief
00295 //   void mountLSR(LSR, Cell);
00296 //   
00297 //   ///\brief updates local frontier and sets properly cells' flags
00298 //   void updateFrontier(Frontier front);//FIXME
00299 //   
00300 //   ///\brief finds the Local Reachable Region and sets properly cells' flags
00301 //   void findLRR();
00302 //   
00303 //   ///\brief
00304 //   void evaluateCell(LSR, Cell);
00305 // 
00306 //   ///\brief
00307 //   Decimal compDistLSRBound(Decimal d, LSR lsr);
00308 //   
00309 //   ///\brief returns the cell selected by its indeces
00310 //   Cell selectCell (IndexPoint);
00311 //   
00312 // //   void setLSRcells(int);
00313 // //   void setFrontierCells(int);
00314 // //   void setLRRcells(int);
00315 // 
00316 //   
00317 // 
00318 //  public:
00319 //   ///default constructor
00320 //   LocalGrid();
00321 //   
00322 //   ///destructor
00323 //   ~LocalGrid();
00324 //   
00325 //   void printGrid();
00326 // /***************************************************************************************************
00327 // ***********************************        SET FUNCTIONS         ***********************************
00328 // ***************************************************************************************************/
00329 //   ///\brief sets board's resolution (equal to cell side size)
00330 //   ///@param value board's resolution to set
00331 //   void setResolution(int value){
00332 //    _resolution=value;
00333 //   }
00334 //   
00335 //   ///\brief sets board's width
00336 //   ///@param value board's width to set
00337 //   void setWidth(int value){
00338 //    _width=value;
00339 //   }
00340 //   
00341 //   ///\brief sets board's height
00342 //   ///@param value board's height to set
00343 //   void setHeight(int value){
00344 //    _height=value;
00345 //   }
00346 // 
00347 //   ///\brief sets board's columns
00348 //   ///@param value board's columns to set
00349 //   void setColumns(int value){
00350 //    _columns=value;
00351 //   }
00352 //   
00353 //   ///\brief sets board's rows
00354 //   ///@param value board's rows to set
00355 //   void setRows(int value){
00356 //    _rows=value;
00357 //   }
00358 //   
00359 //   ///\brief sets board's center
00360 //   ///@param value board's center to set
00361 //   void setCenter(Position value){
00362 //    _center=value;
00363 //   }
00364 //   
00365 //   ///\brief sets board's lowCorner
00366 //   ///@param value board's lowCorner to set
00367 //   void setLowCorner(Position value){
00368 //    _lowCorner=value;
00369 //   }
00370 //   
00371 //   ///\brief sets _firstUpdate flag
00372 //   void setFirstUpdate(){
00373 //    _firstUpdate=true;
00374 //   }
00375 //   
00376 //   ///\brief sets _firstBound flag
00377 //   void setFirstBound(){
00378 //    _firstBound=true;
00379 //   }
00380 //   
00381 //   ///\brief unsets _firstUpdate flag
00382 //   void unsetFirstUpdate(){
00383 //    _firstUpdate=false;
00384 //   }
00385 //   
00386 //   ///\brief unsets _firstBound flag
00387 //   void unsetFirstBound(){
00388 //    _firstBound=false;
00389 //   }
00390 // /***************************************************************************************************
00391 // ***********************************        GET FUNCTIONS         ***********************************
00392 // ***************************************************************************************************/
00393 //   ///\brief return board's resolution (equal to cell side size)
00394 //   int resolution(){
00395 //    return _resolution;
00396 //   }
00397 //   
00398 //   ///\brief return board's width
00399 //   ///@param value board's width to set
00400 //   int width(){
00401 //    return _width;
00402 //   }
00403 //   
00404 //   ///\brief return board's height
00405 //   ///@param value board's height to set
00406 //   int height(){
00407 //    return _height;
00408 //   }
00409 // 
00410 //   ///\brief return board's columns
00411 //   ///@param value board's columns to set
00412 //   int columns(){
00413 //    return _columns;
00414 //   }
00415 //   
00416 //   ///\brief return board's rows
00417 //   ///@param value board's rows to set
00418 //   int rows(){
00419 //    return _rows;
00420 //   }
00421 //   
00422 //   ///\brief return center cell coordinates
00423 //   Position center(){
00424 //    return _center;
00425 //   }
00426 //   
00427 //   ///\brief return lower left cell coordinates
00428 //   Position lowCorner(){
00429 //    return _lowCorner;
00430 //   }
00431 //   
00432 //   ///\brief return _firstUpdate flag
00433 //   bool firstUpdate(){
00434 //    return _firstUpdate;
00435 //   }
00436 //   
00437 //   ///\brief return _firstBound flag
00438 //   bool firstBound(){
00439 //    return _firstBound;
00440 //   }
00441 // };
00442 
00443 
00450 // class LRR{
00451 //  private:
00452 // 
00453 //   LRR();
00454 //   vector<Cell*> lrr;
00455 // 
00456 //   void inizializeLRR ();
00457 //   void resetLRR();
00458 // 
00459 //   void insertCell (Position);
00460 //   void deleteCell (Position);
00461 // 
00462 //   void printLRR (); /**<prints LSR on a file*/
00463 // };
00464 
00471 // class FrontierArc{
00472 //  private:
00473 // 
00474 //   vector<Cell*> arc;
00475 //   
00476 // //   IndexPoint startCell;
00477 // //   IndexPoint endCell;
00478 // //   Position meanCell;
00479 //   /**< number of cells of the arc */
00480 // 
00481 //   int i;
00482 // 
00483 //  public:
00484 //   
00485 //   FrontierArc();
00486 //   ~FrontierArc();
00487 // 
00488 //   int size(void);
00489 //   Cell* first(void);
00490 //   Cell* next(void);
00491 //   void append(Cell* cell);
00492 //   void cancel(Cell*, int pos);
00493 // };
00494 
00501 // class FrontierArc : vector<Cell*> {
00502 //   int i;
00503 // 
00504 //  public:
00505 //   
00506 //   Cell* next(void);
00507 //   void cancel(Cell*, int pos);
00508 // };
00509 
00510 
00511 
00518 // class Frontier{
00519 //  private:
00520 // 
00521 //   vector<FrontierArc*> frontier;
00522 //   bool first;
00523 //   int frontierSize(void);
00524 //   void update(LSR);
00525 //   void clusterize();
00526 // };
00527 
00528 
00529 
00530 // #endif

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6