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

ArRobotConfigPacketReader.h

00001 /*
00002 ActivMedia Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics, LLC
00004 
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 ActivMedia Robotics for information about a commercial version of ARIA at 
00022 robots@activmedia.com or 
00023 ActivMedia Robotics, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 
00025 */
00026 
00027 #ifndef ARROBOTCONFIGPACKETREADER_H
00028 #define ARROBOTCONFIGPACKETREADER_H
00029 
00030 #include "ariaTypedefs.h"
00031 #include "ariaUtil.h"
00032 #include "ArFunctor.h"
00033 
00034 class ArRobot;
00035 class ArRobotPacket;
00036 
00038 class ArRobotConfigPacketReader
00039 {
00040 public:
00042   ArRobotConfigPacketReader(ArRobot *robot, 
00043                                      bool onlyOneRequest = false);
00045   ~ArRobotConfigPacketReader();
00047   bool requestPacket(void);
00049   bool hasPacketBeenRequested(void) const { return myPacketRequested; }
00051   bool hasPacketArrived(void) const { return myPacketArrived; }
00053   void log(void) const;
00055   const char *getType(void) const { return myType.c_str(); }
00057   const char *getSubType(void) const { return mySubType.c_str(); }
00059   const char *getSerialNumber(void) const { return mySerialNumber.c_str(); }
00061   int getRotVelTop(void) const { return myRotVelTop; }
00063   int getTransVelTop(void) const { return myTransVelTop; }
00065   int getRotAccelTop(void) const { return myRotAccelTop; }
00067   int getTransAccelTop(void) const { return myTransAccelTop; }
00069   int getPwmMax(void) const { return myPwmMax; }
00071   const char *getName(void) const { return myName.c_str(); }
00073   int getSipCycleTime(void) const { return mySipCycleTime; }
00075   int getHostBaud(void) const { return myHostBaud; }
00077   int getAux1Baud(void) const { return myAux1Baud; }
00079   bool getHasGripper(void) const { return myHasGripper; }
00081   bool getFrontSonar(void) const { return myFrontSonar; }
00083   bool getRearSonar(void) const { return myRearSonar; }
00085   int getLowBattery(void) const { return myLowBattery; }
00087   int getRevCount(void) const { return myRevCount; }
00089   int getWatchdog(void) const { return myWatchdog; }
00091   bool getNormalMPacs(void) const { return myNormalMPacs; }
00093   int getStallVal(void) const { return myStallVal; }
00095   int getStallCount(void) const { return myStallCount; }
00097   int getJoyVel(void) const { return myJoyVel; }
00099   int getJoyRotVel(void) const { return myJoyRotVel; }
00101   int getRotVelMax(void) const { return myRotVelMax; } 
00103   int getTransVelMax(void) const { return myTransVelMax; } 
00105   int getRotAccel(void) const { return myRotAccel; }
00107   int getRotDecel(void) const { return myRotDecel; }
00109   int getRotKP(void) const { return myRotKP; }
00111   int getRotKV(void) const { return myRotKV; }
00113   int getRotKI(void) const { return myRotKI; }
00115   int getTransAccel(void) const { return myTransAccel; }
00117   int getTransDecel(void) const { return myTransDecel; }
00119   int getTransKP(void) const { return myTransKP; }
00121   int getTransKV(void) const { return myTransKV; }
00123   int getTransKI(void) const { return myTransKI; }
00125   int getFrontBumps(void) const { return myFrontBumps; }
00127   int getRearBumps(void) const { return myRearBumps; }
00129   int getHasCharger(void) const { return myHasCharger; }
00131   int getSonarCycle(void) const { return mySonarCycle; }
00133   bool getResetBaud(void) const { return myResetBaud; }
00135   bool getHasGyro(void) const { return myHasGyro; }
00137   int getDriftFactor(void) const { return myDriftFactor; }
00139   int getAux2Baud(void) const { return myAux2Baud; }
00141   int getAux3Baud(void) const { return myAux3Baud; }
00143   int getTicksMM(void) const { return myTicksMM; }
00145   int getShutdownVoltage(void) const { return myShutdownVoltage; }
00147   bool packetHandler(ArRobotPacket *packet);
00149   void connected(void);
00150 protected:
00151   // the different parameters from the robot
00152   std::string myType;
00153   std::string mySubType;
00154   std::string mySerialNumber;
00155   int myRotVelTop;
00156   int myTransVelTop;
00157   int myRotAccelTop;
00158   int myTransAccelTop;
00159   int myPwmMax;
00160   std::string myName;
00161   int mySipCycleTime;
00162   int myHostBaud;
00163   int myAux1Baud;
00164   bool myHasGripper;
00165   bool myFrontSonar;
00166   bool myRearSonar;
00167   int myLowBattery;
00168   int myRevCount;
00169   int myWatchdog;
00170   bool myNormalMPacs;
00171   int myStallVal;
00172   int myStallCount;
00173   int myJoyVel;
00174   int myJoyRotVel;
00175   int myRotVelMax;
00176   int myTransVelMax;
00177   int myRotAccel;
00178   int myRotDecel;
00179   int myRotKP;
00180   int myRotKV;
00181   int myRotKI;
00182   int myTransAccel;
00183   int myTransDecel;
00184   int myTransKP;
00185   int myTransKV;
00186   int myTransKI;
00187   int myFrontBumps;
00188   int myRearBumps;
00189   int myHasCharger;
00190   int mySonarCycle;
00191   bool myResetBaud;
00192   bool myHasGyro;
00193   int myDriftFactor;
00194   int myAux2Baud;
00195   int myAux3Baud;
00196   int myTicksMM;
00197   int myShutdownVoltage;
00198 
00199   // the robot
00200   ArRobot *myRobot;
00201   // whether only one request can be done or not
00202   bool myOnlyOneRequest;
00203   // whether a request has been made or not
00204   bool myPacketRequested;
00205   // whether our data has been received or not
00206   bool myPacketArrived;
00207   // last time we requested a packet (we'll only ask every 200 ms)
00208   ArTime myLastPacketRequest;
00209   // the callback
00210   ArRetFunctor1C<bool, ArRobotConfigPacketReader, ArRobotPacket *> myPacketHandlerCB;
00211   // callback for connectiosn in case we need to request a config packet
00212   ArFunctorC<ArRobotConfigPacketReader> myConnectedCB;
00213 };
00214 
00215 #endif // ARROBOTCONFIGPACKETREADER_H

Generated on Wed Oct 19 12:56:36 2005 for Aria by  doxygen 1.4.0