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
|
hydrointerfaces/pathplanner2d.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 HYDROINTERFACES_PATHPLANNER2D_H 00011 #define HYDROINTERFACES_PATHPLANNER2D_H 00012 00013 #include <hydroutil/context.h> 00014 #include <gbxutilacfr/exceptions.h> 00015 #include <hydroogmap/hydroogmap.h> 00016 00017 // fwd decl 00018 class QPicture; 00019 00020 namespace hydrointerfaces { 00021 00035 00036 00037 00038 00039 00040 class SOEXPORT PathPlanner2d 00041 { 00042 00043 public: 00044 00049 class QGraphics2dPublisher { 00050 public: 00051 virtual ~QGraphics2dPublisher() {} 00052 00053 virtual void init()=0; 00054 virtual void localSetAndSend( const QPicture &picture )=0; 00055 }; 00056 00058 struct Config { 00059 Config( const hydroogmap::OgMap &m ) 00060 : ogMap(m), graphicsPublisher(0) {} 00061 const hydroogmap::OgMap &ogMap; 00062 QGraphics2dPublisher *graphicsPublisher; 00063 }; 00064 00068 class Exception : public gbxutilacfr::Exception 00069 { 00070 public: 00071 00072 Exception( const char *file, const char *line, const std::string &message ) 00073 : gbxutilacfr::Exception( file, line, message ) {} 00074 virtual ~Exception() throw() {} 00075 00077 void prependMsg( const char *file, const char *line, const std::string &msg ) 00078 { message_ = gbxutilacfr::Exception::toMessageString(file,line,msg) + message_; } 00079 protected: 00080 std::string message_; 00081 }; 00082 00083 class PathStartNotValidException : public Exception 00084 { 00085 public: 00086 PathStartNotValidException( const char *file, const char *line, const std::string &message ) 00087 : Exception( file, line, std::string("PathStartNotValid: ")+message ) {} 00088 }; 00089 00090 class PathDestinationNotValidException : public Exception 00091 { 00092 public: 00093 PathDestinationNotValidException( const char *file, const char *line, const std::string &message ) 00094 : Exception( file, line, std::string("PathDestinationNotValid: ")+message ) {} 00095 }; 00096 00097 class PathDestinationUnreachableException : public Exception 00098 { 00099 public: 00100 PathDestinationUnreachableException( const char *file, const char *line, const std::string &message ) 00101 : Exception( file, line, std::string("PathDestinationUnreachable: ")+message ) {} 00102 }; 00103 00104 struct Point { 00105 Point() {} 00106 Point(double ix, double iy) 00107 : x(ix),y(iy) {} 00108 00109 double x; 00110 double y; 00111 }; 00112 00113 virtual ~PathPlanner2d() {} 00114 00115 // 00116 // Compute the path from 'start' to 'goal'. 00117 // In the returned path, the first element will be on the start, the last will be on the goal. 00118 // 00119 virtual std::vector<Point> computePath( const Point &start, 00120 const Point &goal ) = 0; 00121 00122 private: 00123 00124 00125 }; 00126 00128 class SOEXPORT PathPlanner2dFactory { 00129 public: 00130 virtual ~PathPlanner2dFactory() {}; 00132 virtual PathPlanner2d *createDriver( const PathPlanner2d::Config &config, 00133 const hydroutil::Context &context ) const = 0; 00134 }; 00135 00137 } // namespace 00138 00139 // Function for dynamically instantiating drivers. 00140 // A driver must have a function like so: 00141 // extern "C" { 00142 // hydrointerfaces::PathPlanner2dFactory *createPathPlanner2dDriverFactory(); 00143 // } 00144 typedef hydrointerfaces::PathPlanner2dFactory *PathPlanner2dDriverFactoryMakerFunc(); 00145 00146 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)