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

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydrodrivers/hydrorobot2dplayerclient/driver.h

00001 /*
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_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         std::string 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     bool usePlayerTimestamp_;
00072     
00073     hydroutil::Context context_;
00074 };
00075 
00076 // Used for dynamically loading driver
00077 class Factory : public hydrointerfaces::Robot2dFactory
00078 {
00079 public:
00080     hydrointerfaces::Robot2d *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::Robot2dFactory *createRobot2dDriverFactory();
00091 }
00092 
00093 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5