INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
util.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef HYDRO_PATHPLAN_UTIL_H 00011 #define HYDRO_PATHPLAN_UTIL_H 00012 00013 #include <vector> 00014 #include <hydroogmap/hydroogmap.h> 00015 #include "cell2d.h" 00016 #include "typemap.h" 00017 00018 namespace hydropathplan 00019 { 00020 00022 class CostEvaluator { 00023 public: 00024 virtual ~CostEvaluator() {} 00025 00026 // returns the cost of moving through a cell whose 4-distance to the nearest obstacle is distInMetres. 00027 virtual double costAtDistFromObstacle( double distInMetres ) const=0; 00028 }; 00029 00031 class DefaultCostEvaluator : public CostEvaluator { 00032 public: 00033 double costAtDistFromObstacle( double distInMetres ) const 00034 { if ( distInMetres > 0 ) return 1; else return NAN; } 00035 }; 00036 00037 // The 'util' namespace contains stuff that's not intended for use outside of this library. 00038 namespace util { 00039 00043 bool isTraversable( const hydroogmap::OgMap &ogMap, 00044 const int indX, 00045 const int indY, 00046 const float traversabilityThreshhold); 00047 00049 inline bool isTraversable( const hydroogmap::OgMap &ogMap, 00050 const Cell2D &cell, 00051 const float traversabilityThreshhold) 00052 { return isTraversable(ogMap,cell.x(),cell.y(),traversabilityThreshhold); } 00053 00055 bool isTraversableNeighbors( const hydroogmap::OgMap &ogMap, 00056 const int indX, 00057 const int indY, 00058 const float traversabilityThreshhold ); 00059 00061 bool isTraversableAll8Neighbors( const hydroogmap::OgMap &ogMap, 00062 const int indX, 00063 const int indY, 00064 const float traversabilityThreshhold ); 00065 00067 bool losExists( const hydroogmap::OgMap &ogMap, 00068 double traversabilityThreshhold, 00069 const Cell2D &c1, 00070 const Cell2D &c2 ); 00071 00074 int robotDiameterInCells( const hydroogmap::OgMap &ogMap, const double robotDiameterMetres ); 00075 00078 // TODO: AlexB: Why grow by the diameter rather than the radius?? 00079 void growObstaclesOgMap( hydroogmap::OgMap &ogMap, 00080 const double traversabilityThreshhold, 00081 const int robotDiameterCells ); 00082 00090 void optimizePath( const hydroogmap::OgMap &ogMap, 00091 double traversabilityThreshhold, 00092 const Cell2DVector &origPath, 00093 Cell2DVector &optimisedPath ); 00094 00096 float straightLineCost( const Cell2D &fromCell, 00097 const Cell2D &toCell, 00098 const FloatMap &costMap ); 00099 00100 } 00101 00102 } 00103 00104 #endif 00105 |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)