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/hydrosegwayrmpplayerclient/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_PLAYER_CLIENT_H 00012 #define HYDRO_SEGWAYRMP_PLAYER_CLIENT_H 00013 00014 #include <hydrointerfaces/segwayrmp.h> 00015 00016 // Player proxies 00017 namespace PlayerCc 00018 { 00019 class PlayerClient; 00020 class Position2dProxy; 00021 class Position3dProxy; 00022 class PowerProxy; 00023 } 00024 00025 namespace segwayrmpplayerclient 00026 { 00027 00028 class Driver : public hydrointerfaces::SegwayRmp 00029 { 00030 public: 00031 00032 Driver( const std::string &powerbaseName, const hydroutil::Context& context ); 00033 virtual ~Driver(); 00034 00035 // from SegwayRmp 00036 virtual void enable(); 00037 virtual void read( Data& data ); 00038 virtual void write( const Command& command ); 00039 virtual hydrointerfaces::SegwayRmp::Capabilities capabilities() const; 00040 00041 private: 00042 // 00043 // Convenience structure to hold all the config parameters. 00044 // All units are S.I. 00045 // 00046 class Config 00047 { 00048 public: 00049 Config(); 00050 00051 std::string host; 00052 int port; 00053 00054 // returns 0 if everything looks good. 00055 int verify( std::string& warnings, std::string& errors ); 00056 00057 void fromProperties( const hydroutil::Properties& props ); 00058 std::string toString(); 00059 }; 00060 00061 virtual void disable(); 00062 00063 bool enabled_; 00064 PlayerCc::PlayerClient *robot_; 00065 PlayerCc::Position2dProxy *position2dProxy_; 00066 PlayerCc::Position3dProxy *position3dProxy_; 00067 PlayerCc::PowerProxy *powerProxy_; 00068 00069 // configuration 00070 const std::string powerbaseName_; 00071 Config config_; 00072 hydroutil::Context context_; 00073 }; 00074 00075 // Used for dynamically loading driver 00076 class Factory : public hydrointerfaces::SegwayRmpFactory 00077 { 00078 public: 00079 hydrointerfaces::SegwayRmp *createDriver( const std::string &powerbaseName, 00080 const hydroutil::Context &context ) const 00081 { 00082 return new Driver( powerbaseName, context ); 00083 } 00084 }; 00085 00086 } // namespace 00087 00088 // Used for dynamically loading driver 00089 extern "C" { 00090 hydrointerfaces::SegwayRmpFactory *createSegwayRmpDriverFactory(); 00091 } 00092 00093 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)