orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

robot2dplayerclient/driver.h

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

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5