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
|
robot2d.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 00011 #ifndef HYDRO_INTERFACES_ROBOT2D_H 00012 #define HYDRO_INTERFACES_ROBOT2D_H 00013 00014 #include <hydroutil/context.h> 00015 #include <exception> 00016 00017 namespace hydrointerfaces 00018 { 00019 00044 class SOEXPORT Robot2d 00045 { 00046 00047 public: 00048 00050 class Data 00051 { 00052 public: 00054 int seconds; 00056 int useconds; 00058 double x; 00060 double y; 00062 double yaw; 00064 double vlong; 00066 double vtransverse; 00068 double dyaw; 00069 00071 std::string toString() const; 00072 }; 00073 00075 class Command 00076 { 00077 public: 00079 double vlong; 00081 double vtransverse; 00083 double dyaw; 00084 00086 std::string toString() const; 00087 }; 00088 00090 class Exception : public std::exception 00091 { 00092 public: 00094 Exception(const char *message) 00095 : message_(message) {} 00097 Exception(const std::string &message) 00098 : message_(message) {} 00099 00100 virtual ~Exception() throw() {} 00102 virtual const char* what() const throw() { return message_.c_str(); } 00103 00104 protected: 00105 00106 std::string message_; 00107 }; 00108 00109 virtual ~Robot2d() {} 00110 00115 virtual void enable()=0; 00116 00121 virtual bool read( Data &data )=0; 00122 00124 virtual void write( const Command& command )=0; 00125 00132 virtual void getStatus( std::string &status, bool &isWarn, bool &isFault )=0; 00133 00135 virtual void applyHardwareLimits( double &maxForwardSpeed, double &maxReverseSpeed, 00136 double &maxTurnrate, double &maxTurnrateAtMaxSpeed )=0; 00137 00138 }; 00139 00141 class SOEXPORT Robot2dFactory { 00142 public: 00143 virtual ~Robot2dFactory() {}; 00145 virtual Robot2d *createDriver( const hydroutil::Context& context ) const=0; 00146 }; 00147 00149 } // namespace 00150 00151 // Function for dynamically instantiating drivers. 00152 // A driver must have a function like so: 00153 // extern "C" { 00154 // hydrointerfaces::Robot2dFactory *createRobot2dDriverFactory(); 00155 // } 00156 typedef hydrointerfaces::Robot2dFactory *Robot2dDriverFactoryMakerFunc(); 00157 00158 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)