Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArRobotParams.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARROBOTPARAMS_H
00027 #define ARROBOTPARAMS_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ArConfig.h"
00031 
00033 class ArRobotParams : public ArConfig
00034 {
00035 public:
00037   AREXPORT ArRobotParams();
00039   AREXPORT virtual ~ArRobotParams();
00041   const char *getClassName(void) const { return myClass; }
00043   const char *getSubClassName(void) const { return mySubClass; }
00045   double getRobotRadius(void) const { return myRobotRadius; }
00047   double getRobotDiagonal(void) const { return myRobotDiagonal; }
00049   double getRobotWidth(void) const { return myRobotWidth; }
00051   double getRobotLength(void) const { return myRobotLength; }
00053   double getRobotLengthFront(void) const { return myRobotLengthFront; }
00055   double getRobotLengthRear(void) const { return myRobotLengthRear; }
00057   bool isHolonomic(void) const { return myHolonomic; }
00059   bool hasMoveCommand(void) const { return myHaveMoveCommand; }
00061   int getAbsoluteMaxVelocity(void) const { return myAbsoluteMaxVelocity; }
00063   int getAbsoluteMaxRotVelocity(void) const { return myAbsoluteMaxRVelocity; }
00065   bool getRequestIOPackets(void) const { return myRequestIOPackets; }
00067   bool getRequestEncoderPackets(void) const { return myRequestEncoderPackets; }
00069   int getSwitchToBaudRate(void) const { return mySwitchToBaudRate; }
00071   double getAngleConvFactor(void) const { return myAngleConvFactor; }
00073   double getDistConvFactor(void) const { return myDistConvFactor; }
00075   double getVelConvFactor(void) const { return myVelConvFactor; }
00077   double getRangeConvFactor(void) const { return myRangeConvFactor; }
00079   double getDiffConvFactor(void) const { return myDiffConvFactor; }
00081   double getVel2Divisor(void) const { return myVel2Divisor; }
00083   double getGyroScaler(void) const { return myGyroScaler; }
00085   bool haveTableSensingIR(void) const { return myTableSensingIR; }
00087   bool haveNewTableSensingIR(void) const { return myNewTableSensingIR; }
00089   bool haveFrontBumpers(void) const { return myFrontBumpers; }
00091   int numFrontBumpers(void) const { return myNumFrontBumpers; }
00093   bool haveRearBumpers(void) const { return myRearBumpers; }
00095   int numRearBumpers(void) const { return myNumRearBumpers; }
00097   int getNumIR(void) const { return myNumIR; }
00099   bool haveIR(int number) const
00100     {
00101       if (myIRMap.find(number) != myIRMap.end())
00102     return true;
00103       else
00104     return false;
00105     }
00107   int getIRX(int number)
00108     {
00109       std::map<int, std::map<int, int> >::iterator it;
00110       std::map<int, int>::iterator it2;
00111       if ((it = myIRMap.find(number)) == myIRMap.end())
00112     return 0;
00113       if ((it2 = (*it).second.find(IR_X)) == (*it).second.end())
00114 
00115     return 0;
00116       return (*it2).second;
00117     }
00119   int getIRY(int number)
00120     {
00121       std::map<int, std::map<int, int> >::iterator it;
00122       std::map<int, int>::iterator it2;
00123       if ((it = myIRMap.find(number)) == myIRMap.end())
00124     return 0;
00125       if ((it2 = (*it).second.find(IR_Y)) == (*it).second.end())
00126     return 0;
00127       return (*it2).second;
00128     }
00129   int getIRType(int number)
00130     {
00131       std::map<int, std::map<int, int> >::iterator it;
00132       std::map<int, int>::iterator it2;
00133       if ((it = myIRMap.find(number)) == myIRMap.end())
00134     return 0;
00135       if ((it2 = (*it).second.find(IR_TYPE)) == (*it).second.end())
00136     return 0;
00137       return (*it2).second;
00138     }
00139   int getIRCycles(int number)
00140     {
00141       std::map<int, std::map<int, int> >::iterator it;
00142       std::map<int, int>::iterator it2;
00143       if ((it = myIRMap.find(number)) == myIRMap.end())
00144     return 0;
00145       if ((it2 = (*it).second.find(IR_CYCLES)) == (*it).second.end())
00146     return 0;
00147       return (*it2).second;
00148     }
00150   int getNumSonar(void) const { return myNumSonar; }
00152   bool haveSonar(int number)
00153     {
00154       if (mySonarMap.find(number) != mySonarMap.end())
00155     return true;
00156       else
00157     return false;
00158     }
00160   int getSonarX(int number)
00161     {
00162       std::map<int, std::map<int, int> >::iterator it;
00163       std::map<int, int>::iterator it2;
00164       if ((it = mySonarMap.find(number)) == mySonarMap.end())
00165     return 0;
00166       if ((it2 = (*it).second.find(SONAR_X)) == (*it).second.end())
00167     return 0;
00168       return (*it2).second;
00169     }
00171   int getSonarY(int number)
00172     {
00173       std::map<int, std::map<int, int> >::iterator it;
00174       std::map<int, int>::iterator it2;
00175       if ((it = mySonarMap.find(number)) == mySonarMap.end())
00176     return 0;
00177       if ((it2 = (*it).second.find(SONAR_Y)) == (*it).second.end())
00178     return 0;
00179       return (*it2).second;
00180     }
00182   int getSonarTh(int number)
00183     {
00184       std::map<int, std::map<int, int> >::iterator it;
00185       std::map<int, int>::iterator it2;
00186       if ((it = mySonarMap.find(number)) == mySonarMap.end())
00187     return 0;
00188       if ((it2 = (*it).second.find(SONAR_TH)) == (*it).second.end())
00189     return 0;
00190       return (*it2).second;
00191     }
00193   bool getLaserPossessed(void) const { return myLaserPossessed; }
00195   const char *getLaserPort(void) const { return myLaserPort; }
00197   bool getLaserPowerControlled(void) const { return myLaserPowerControlled; }
00199   bool getLaserFlipped(void) const { return myLaserFlipped; }
00201   int getLaserX(void) const { return myLaserX; }
00203   int getLaserY(void) const { return myLaserY; }
00205   double getLaserTh(void) const { return myLaserTh; }
00207   const char *getLaserIgnore(void) const { return myLaserIgnore; }
00209   bool hasSettableVelMaxes(void) const { return mySettableVelMaxes; }
00211   int getTransVelMax(void) const { return myTransVelMax; }
00213   int getRotVelMax(void) const { return myRotVelMax; }
00215   bool hasSettableAccsDecs(void) const { return mySettableAccsDecs; }
00217   int getTransAccel(void) const { return myTransAccel; }
00219   int getTransDecel(void) const { return myTransDecel; }
00221   int getRotAccel(void) const { return myRotAccel; }
00223   int getRotDecel(void) const { return myRotDecel; }
00225   AREXPORT bool save(void);
00226 protected:
00227   char myClass[1024];
00228   char mySubClass[1024];
00229   double myRobotRadius;
00230   double myRobotDiagonal;
00231   double myRobotWidth;
00232   double myRobotLength;
00233   double myRobotLengthFront;
00234   double myRobotLengthRear;
00235   bool myHolonomic;
00236   int myAbsoluteMaxRVelocity;
00237   int myAbsoluteMaxVelocity;
00238   bool myHaveMoveCommand;
00239   bool myRequestIOPackets;
00240   bool myRequestEncoderPackets;
00241   int mySwitchToBaudRate;
00242   double myAngleConvFactor;
00243   double myDistConvFactor;
00244   double myVelConvFactor;
00245   double myRangeConvFactor;
00246   double myDiffConvFactor;
00247   double myVel2Divisor;
00248   double myGyroScaler;
00249   bool myTableSensingIR;
00250   bool myNewTableSensingIR;
00251   bool myFrontBumpers;
00252   int myNumFrontBumpers;
00253   bool myRearBumpers;
00254   int myNumRearBumpers;
00255   bool myLaserPossessed;
00256   char myLaserPort[1024];
00257   bool myLaserFlipped;
00258   bool myLaserPowerControlled;
00259   int myLaserX;
00260   int myLaserY;
00261   double myLaserTh;
00262   char myLaserIgnore[1024];
00263   
00264   bool mySettableVelMaxes;
00265   int myTransVelMax;
00266   int myRotVelMax;
00267   bool mySettableAccsDecs;
00268   int myTransAccel;
00269   int myTransDecel;
00270   int myRotAccel;
00271   int myRotDecel;
00272 
00273   // IRs
00274   int myNumIR;
00275   std::map<int, std::map<int, int> > myIRMap;
00276   enum IRInfo 
00277   { 
00278     IR_X, 
00279     IR_Y,
00280     IR_TYPE,
00281     IR_CYCLES
00282   };
00283   AREXPORT void internalSetIR(int num, int type, int cycles, int x, int y);
00284   AREXPORT bool parseIRUnit(ArArgumentBuilder *builder);
00285   AREXPORT const std::list<ArArgumentBuilder *> *getIRUnits(void);
00286   std::list<ArArgumentBuilder *> myGetIRUnitList;
00287   ArRetFunctorC<const std::list<ArArgumentBuilder *> *, ArRobotParams> myIRUnitGetFunctor;
00288   ArRetFunctor1C<bool, ArRobotParams, ArArgumentBuilder *> myIRUnitSetFunctor;
00289 
00290   // Sonar
00291   int myNumSonar;
00292   std::map<int, std::map<int, int> > mySonarMap;
00293   enum SonarInfo 
00294   { 
00295     SONAR_X, 
00296     SONAR_Y, 
00297     SONAR_TH
00298   };
00299   AREXPORT void internalSetSonar(int num, int x, int y, int th);
00300   AREXPORT bool parseSonarUnit(ArArgumentBuilder *builder);
00301   AREXPORT const std::list<ArArgumentBuilder *> *getSonarUnits(void);
00302   std::list<ArArgumentBuilder *> myGetSonarUnitList;
00303   ArRetFunctorC<const std::list<ArArgumentBuilder *> *, ArRobotParams> mySonarUnitGetFunctor;
00304   ArRetFunctor1C<bool, ArRobotParams, ArArgumentBuilder *> mySonarUnitSetFunctor;
00305 };
00306 
00307 #endif // ARROBOTPARAMS_H

Generated on Tue Feb 20 10:51:41 2007 for Aria by  doxygen 1.4.0