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
|
hydrodrivers/hydrosegwayrmpfake/driver.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_SEGWAYRMP_FAKE_H 00012 #define HYDRO_SEGWAYRMP_FAKE_H 00013 00014 #include <hydrointerfaces/segwayrmp.h> 00015 00016 namespace segwayrmpfake 00017 { 00018 00019 /* 00020 A fake driver to simplify development. Does not require any hardware. 00021 */ 00022 class Driver : public hydrointerfaces::SegwayRmp 00023 { 00024 public: 00025 00026 Driver( const std::string &powerbaseName, const hydroutil::Context& context ); 00027 virtual ~Driver(); 00028 00029 // from SegwayRmp 00030 virtual void enable(); 00031 virtual void read( Data& data ); 00032 virtual void write( const Command& command ); 00033 virtual hydrointerfaces::SegwayRmp::Capabilities capabilities() const; 00034 private: 00035 // configurable sleep interval before returning from read() [milliseconds] 00036 int sleepIntervalMs_; 00037 00038 const std::string powerbaseName_; 00039 00040 hydroutil::Context context_; 00041 }; 00042 00043 // Used for dynamically loading driver 00044 class Factory : public hydrointerfaces::SegwayRmpFactory 00045 { 00046 public: 00047 hydrointerfaces::SegwayRmp *createDriver( const std::string &powerbaseName, 00048 const hydroutil::Context &context ) const 00049 { 00050 return new Driver( powerbaseName, context ); 00051 } 00052 }; 00053 00054 } // namespace 00055 00056 // Used for dynamically loading driver 00057 extern "C" { 00058 hydrointerfaces::SegwayRmpFactory *createSegwayRmpDriverFactory(); 00059 } 00060 00061 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)