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
|
bicycle.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_BICYCLE_H 00012 #define HYDRO_INTERFACES_BICYCLE_H 00013 00014 #include <hydroutil/context.h> 00015 #include <exception> 00016 00017 namespace hydrointerfaces 00018 { 00019 00044 class SOEXPORT Bicycle 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 steerAngle; 00066 double vlong; 00068 double dyaw; 00069 00071 std::string toString() const; 00072 }; 00073 00075 class Command 00076 { 00077 public: 00079 double vlong; 00081 double steerAngle; 00082 00084 std::string toString() const; 00085 }; 00086 00088 class Exception : public std::exception 00089 { 00090 public: 00092 Exception(const char *message) 00093 : message_(message) {} 00095 Exception(const std::string &message) 00096 : message_(message) {} 00097 00098 virtual ~Exception() throw() {} 00100 virtual const char* what() const throw() { return message_.c_str(); } 00101 00102 protected: 00103 00104 std::string message_; 00105 }; 00106 00107 virtual ~Bicycle() {} 00108 00113 virtual void enable()=0; 00114 00119 virtual bool read( Data &data )=0; 00120 00122 virtual void write( const Command& command )=0; 00123 00130 virtual void getStatus( std::string &status, bool &isWarn, bool &isFault )=0; 00131 }; 00132 00134 class SOEXPORT BicycleFactory { 00135 public: 00136 virtual ~BicycleFactory() {}; 00138 virtual Bicycle *createDriver( const hydroutil::Context& context ) const=0; 00139 }; 00140 00142 } // namespace 00143 00144 // Function for dynamically instantiating drivers. 00145 // A driver must have a function like so: 00146 // extern "C" { 00147 // hydrointerfaces::BicycleFactory *createBicycleDriverFactory(); 00148 // } 00149 typedef hydrointerfaces::BicycleFactory *BicycleDriverFactoryMakerFunc(); 00150 00151 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)