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/hydromhipa10fake/driver.h00001 /************************************************************************* 00002 00003 date : August 2008 00004 copyright : (C) 2005 J.D. Yamokoski 00005 email : yamokosk+gnu at gmail dot com 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public License as 00009 published by the Free Software Foundation; either version 2.1 of the License, 00010 or (at your option) any later version. The text of the GNU Lesser General 00011 Public License is included with this library in the file LICENSE.TXT. 00012 00013 This library is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00015 or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE.TXT for 00016 more details. 00017 00018 *************************************************************************/ 00019 00020 #ifndef HYDRO_MHI_PA10_FAKE_H 00021 #define HYDRO_MHI_PA10_FALE_H 00022 00023 #include <hydrointerfaces/mhipa10.h> 00024 #include <newmat/newmat.h> 00025 #include <newmat/newmatio.h> 00026 #include <roboop/robot.h> 00027 00028 namespace mhipa10arc 00029 { 00030 00031 /* 00032 A fake PA10 driver. Uses an internal model to generate realistic values in response 00033 to user commands. 00034 00035 @author J.D. Yamokoski 00036 */ 00037 class Driver : public hydrointerfaces::MitsubishiPA10 00038 { 00039 typedef std::auto_ptr< ManipulatorData > ManipulatorDataPtr; 00040 00041 public: 00042 Driver( const hydrointerfaces::MitsubishiPA10::ManipulatorConfig& config, const hydroutil::Context& context ); 00043 virtual ~Driver(); 00044 00045 // from MitsubishiPA10 00046 virtual void enable(); 00047 virtual bool read( ManipulatorData& data ); 00048 virtual void write( const ManipulatorCommand& command ); 00049 virtual void getStatus( std::string &status, bool &isWarn, bool &isFault ); 00050 00051 // To start and stop motion control 00052 void startMotionControl(); 00053 void stopMotionControl(); 00054 00055 // Returns whether the PA10 is accepting motion control commands 00056 bool isMotionEnabled() {return isMotionControlStarted_;} 00057 00058 private: 00059 virtual void checkCommand( ManipulatorCommand& cmd ); 00060 00061 // A static function to compute derivatives from model 00062 static ReturnMatrix calc_xdot(Real t, const Matrix& xin); 00063 00064 // Flag to remember if new data has come in since the previous read attempt 00065 bool isNewData_; 00066 00067 // Flag to remember if the start motion control command was sent 00068 bool isMotionControlStarted_; 00069 00070 // Local storage of the manipulator description 00071 ManipulatorConfig config_; 00072 00073 // Last state information 00074 ColumnVector oldState_; 00075 static ColumnVector oldCommand_; 00076 00077 // Model 00078 static Robot* model_; 00079 00080 hydroutil::Context context_; 00081 }; 00082 00083 class MitsubishiPA106CFactory : public hydrointerfaces::MitsubishiPA10Factory 00084 { 00085 public: 00086 virtual ~MitsubishiPA106CFactory() {}; 00088 virtual hydrointerfaces::MitsubishiPA10* createDriver( const hydrointerfaces::MitsubishiPA10::ManipulatorConfig& config, const hydroutil::Context& context ) const; 00089 }; 00090 00091 00092 } // namespace 00093 00094 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)