orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
segwayrmpplayerclient/driver.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 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 hydroutil::Context& context ); 00033 virtual ~Driver(); 00034 00035 // from SegwayRmp 00036 virtual void enable(); 00037 virtual bool read( Data& data ); 00038 virtual void write( const Command& command ); 00039 virtual void getStatus( std::string &status, bool &isWarn, bool &isFault ); 00040 virtual void applyHardwareLimits( double &maxForwardSpeed, double &maxReverseSpeed, 00041 double &maxTurnrate, double &maxTurnrateAtMaxSpeed ); 00042 00043 private: 00044 // 00045 // Convenience structure to hold all the config parameters. 00046 // All units are S.I. 00047 // 00048 class Config 00049 { 00050 public: 00051 Config(); 00052 00053 const char *host; 00054 int port; 00055 00056 // returns 0 if everything looks good. 00057 int verify( std::string& warnings, std::string& errors ); 00058 00059 void fromProperties( const hydroutil::Properties& props ); 00060 std::string toString(); 00061 }; 00062 00063 virtual void disable(); 00064 00065 bool enabled_; 00066 PlayerCc::PlayerClient *robot_; 00067 // PlayerCc::Position2dProxy *positionProxy_; 00068 PlayerCc::Position3dProxy *position3dProxy_; 00069 PlayerCc::PowerProxy *powerProxy_; 00070 00071 // configuration 00072 Config config_; 00073 hydroutil::Context context_; 00074 }; 00075 00076 // Used for dynamically loading driver 00077 class Factory : public hydrointerfaces::SegwayRmpFactory 00078 { 00079 public: 00080 hydrointerfaces::SegwayRmp *createDriver( const hydroutil::Context &context ) const 00081 { 00082 return new Driver( context ); 00083 } 00084 }; 00085 00086 } // namespace 00087 00088 // Used for dynamically loading driver 00089 extern "C" { 00090 hydrointerfaces::SegwayRmpFactory *createDriverFactory(); 00091 } 00092 00093 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)