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

 

         

mhipa10.h

00001 /*************************************************************************
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 MITSUBISHIPA10_
00021 #define MITSUBISHIPA10_
00022 
00023 #include <exception>
00024 #include <vector>
00025 
00026 #include <hydroutil/context.h>
00027 
00028 namespace hydrointerfaces
00029 {
00030 
00031 class MitsubishiPA10
00032 {
00033 public:
00034         static const float maxRatedMotorTorque[7];
00035         
00036         struct LinkConfig
00037         {
00038                 std::string Name;
00039                 float JointAngle;
00040                 float JointOffset;
00041                 float LinkLength;
00042                 float TwistAngle;
00043                 float MinJointAngle;
00044                 float MaxJointAngle;
00045                 float MaxJointVelocity;
00046                 float JointAngleOffset;
00047                 float LinkMass;
00048                 float CenterOfMass[3];
00049                 float Inertia[6]; // Ixx, Ixy, Ixz, Iyy, Iyz, Izz
00050                 float MaxTorque;
00051                 float MotorInertia;
00052                 float GearRatio;
00053                 float ViscousFriction;
00054                 float CoulombFriction;
00055                 bool Immobile;  
00056         };
00057         
00058         struct ManipulatorConfig
00059         {
00060                 bool AngleInDegree;
00061                 bool IgnoreMotorDynamics;
00062                 std::vector< LinkConfig > links;
00063         };
00064         
00066         struct ServoData
00067         {
00068                 ServoData() :
00069                         isPowered(false),
00070                         isControllable(false),
00071                         inWarning(true),
00072                         inFault(true),
00073                         angle(0.0),
00074                         speed(0.0),
00075                         torque(0.0)
00076                 { }
00078                 bool isPowered;
00079                 bool isControllable;
00081                 bool inWarning;
00082                 bool inFault;
00083                 std::vector< std::string > msg;
00085                 double angle;
00086                 float speed;
00087                 float torque;
00089                 std::string toString() const;
00090         };
00091 
00093         struct ManipulatorData
00094         {
00095                 ManipulatorData(unsigned int servonum=7) :
00096                         seconds(0),
00097                         useconds(0),
00098                         isControllable(false),
00099                         powerOutputOn(false),
00100                         nominalPowerSourceTemp(false),
00101                         limitSwitchOpen(false),
00102                         estopSwitchOpen(false),
00103                         deadmanSwitchClosed(false),
00104                         teachingSwitchOpen(false),
00105                         inWarning(true),
00106                         inFault(true)
00107                 {
00108                         servoData.resize(servonum);
00109                 }
00111                 int seconds;
00113                 int useconds;
00115                 bool isControllable;
00117                 bool powerOutputOn;
00118                 bool nominalPowerSourceTemp;
00120                 bool limitSwitchOpen;
00121                 bool estopSwitchOpen;
00122                 bool deadmanSwitchClosed;
00123                 bool teachingSwitchOpen;
00125                 bool inWarning;
00126                 bool inFault;
00127                 std::vector< std::string > msg;
00129                 float mobility;
00131                 std::vector<ServoData> servoData;
00133                 std::string toString() const;
00134         };
00135 
00136         struct ServoCmd
00137         {
00138                 ServoCmd(bool servoON=true, bool brakeON=true, bool isTrqCmd=false, float cmdValue=0.0) :
00139                         servoON(servoON), brakeON(brakeON), isTorqueCmd(isTrqCmd), cmdValue(cmdValue) {}
00140                 bool servoON;
00141                 bool brakeON;
00142                 bool isTorqueCmd;
00143                 float cmdValue;
00145                 std::string toString() const;
00146         };
00147 
00149         struct ManipulatorCommand
00150         {
00152                 int seconds;
00154                 int useconds;
00156                 bool enableMotion;
00158                 std::vector<ServoCmd> servoCmds;
00160                 std::string toString() const;
00161         };
00162 
00164         class Exception : public std::exception
00165         {
00166         public:
00168             Exception(const char *message) : message_(message) {}
00170             Exception(const std::string &message) : message_(message) {}
00171             virtual ~Exception() throw() {}
00173             virtual const char* what() const throw() { return message_.c_str(); }
00174         protected:
00175             std::string  message_;
00176         };
00177         
00178         MitsubishiPA10() {};
00179         virtual ~MitsubishiPA10() {}
00180 
00185         virtual void enable()=0;
00186 
00191         virtual bool read( ManipulatorData &data )=0;
00192 
00194         virtual void write( const ManipulatorCommand& command )=0;
00195 
00202         virtual void getStatus( std::string &status, bool &isWarn, bool &isFault )=0;
00203 
00204         virtual void startMotionControl() = 0;
00205         virtual void stopMotionControl() = 0;
00206         
00207         // Returns whether the PA10 is accepting motion control commands
00208         virtual bool isMotionEnabled() = 0;
00209 
00210         virtual void checkCommand( ManipulatorCommand& command ) = 0;
00211         
00213         /*virtual void applyHardwareLimits( double &maxForwardSpeed,
00214                                       double &maxReverseSpeed,
00215                                       double &maxTurnrate,
00216                                       double &maxLateralAcceleration )=0;*/
00217         static ManipulatorCommand createBrakeONCmd();
00218         static ManipulatorCommand createBrakeOFFNoMotionCmd();
00219 };
00220 
00222 class MitsubishiPA10Factory
00223 {
00224 public:
00225         virtual ~MitsubishiPA10Factory() {};
00227         virtual MitsubishiPA10* createDriver( const MitsubishiPA10::ManipulatorConfig& config, const hydroutil::Context& context ) const = 0;
00228 };
00229 
00231 } // namespace
00232 
00233 // Function for dynamically instantiating drivers.
00234 // A driver must have a function like so:
00235 // extern "C" {
00236 //     hydrointerfaces::SegwayRmpFactory *createMitsubishiPA10DriverFactory();
00237 // }
00238 typedef hydrointerfaces::MitsubishiPA10Factory *MitsubishiPA10DriverFactoryMakerFunc();
00239 
00240 
00241 #endif /*MITSUBISHIPA10_*/
 

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


Generated for Orca Robotics by  doxygen 1.4.5