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

 

         

segwayrmp.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_INTERFACES_SEGWAYRMP_H
00012 #define HYDRO_INTERFACES_SEGWAYRMP_H
00013 
00014 #include <hydroutil/context.h>
00015 #include <exception>
00016 
00017 namespace hydrointerfaces
00018 {
00019 
00044 class SOEXPORT SegwayRmp
00045 {
00046 
00047 public: 
00048 
00050     class Data
00051     {
00052     public:
00054         int seconds;
00056         int useconds;
00058         double x;
00060         double y;
00062         double roll;
00064         double pitch;
00066         double yaw;
00068         double vx;
00070         double droll;
00072         double dpitch;
00074         double dyaw;
00076         double leftTorque;
00078         double rightTorque;
00080         double mainvolt;
00082         double uivolt;
00083     
00085         std::string toString() const;
00086     };
00087     
00089     class Command
00090     {
00091     public:
00093         double vx;
00095         double w;
00096     
00098         std::string toString() const;
00099     };
00100 
00102     class Exception : public std::exception
00103     {
00104     public:
00106         Exception(const char *message)
00107             : message_(message) {}
00109         Exception(const std::string &message)
00110             : message_(message) {}
00111     
00112         virtual ~Exception() throw() {}
00114         virtual const char* what() const throw() { return message_.c_str(); }
00115     
00116     protected:
00117     
00118         std::string  message_;
00119     };
00120 
00121     virtual ~SegwayRmp() {}
00122 
00127     virtual void enable()=0;
00128 
00133     virtual bool read( Data &data )=0;
00134     
00136     virtual void write( const Command& command )=0;
00137 
00144     virtual void getStatus( std::string &status, bool &isWarn, bool &isFault )=0;
00145 
00147     virtual void applyHardwareLimits( double &maxForwardSpeed,
00148                                       double &maxReverseSpeed,
00149                                       double &maxTurnrate,
00150                                       double &maxLateralAcceleration )=0;
00151 };
00152 
00154 class SOEXPORT SegwayRmpFactory {
00155 public:
00156     virtual ~SegwayRmpFactory() {};
00158     virtual SegwayRmp *createDriver( const hydroutil::Context& context ) const=0;
00159 };
00160 
00162 } // namespace
00163 
00164 // Function for dynamically instantiating drivers.
00165 // A driver must have a function like so:
00166 // extern "C" {
00167 //     hydrointerfaces::SegwayRmpFactory *createDriverFactory();
00168 // }
00169 typedef hydrointerfaces::SegwayRmpFactory *DriverFactoryMakerFunc();
00170 
00171 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5