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

ArDPPTU.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 ARDPPTU_H
00027 #define ARDPPTU_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ArRobot.h"
00031 #include "ArPTZ.h"
00032 
00043 
00044 class ArDPPTUCommands
00045 {
00046 public:
00047   enum {
00048     DELIM = 0x20, 
00049     INIT = 0x40, 
00050     ACCEL = 0x61, 
00051     BASE = 0x62, 
00052     CONTROL = 0x63, 
00053     DISABLE = 0x64, 
00054     ENABLE = 0x65, 
00055     FACTORY = 0x66, 
00056     HALT = 0x68, 
00057     IMMED = 0x69, 
00058     LIMIT = 0x6C, 
00059     MONITOR = 0x6D, 
00060     OFFSET = 0x6F, 
00061     PAN = 0x70, 
00062     RESET = 0x72, 
00063     SPEED = 0x73, 
00064     TILT = 0x74, 
00065     UPPER = 0x75, 
00066     VELOCITY = 0x76 
00067   };
00068 
00069 };
00070 
00072 
00077 class ArDPPTUPacket: public ArBasePacket
00078 {
00079 public:
00081   AREXPORT ArDPPTUPacket(ArTypes::UByte2 bufferSize = 30);
00083   AREXPORT virtual ~ArDPPTUPacket();
00084 
00085   AREXPORT virtual void byte2ToBuf(int val);
00086 
00087   AREXPORT virtual void finalizePacket(void);
00088 
00089 protected:
00090 };
00091 
00093 class ArDPPTU : public ArPTZ
00094 {
00095 public:
00097   AREXPORT ArDPPTU(ArRobot *robot);
00099   AREXPORT virtual ~ArDPPTU();
00100 
00101   AREXPORT bool init(void);
00102 
00103   AREXPORT bool canZoom(void) const { return 0; }
00104 
00106   AREXPORT bool blank(void);
00107 
00109   AREXPORT bool resetCalib(void);
00111   AREXPORT bool disableReset(void);
00113   AREXPORT bool resetTilt(void);
00115   AREXPORT bool resetPan(void);
00117   AREXPORT bool resetAll(void);
00118 
00120   AREXPORT bool saveSet(void);
00122   AREXPORT bool restoreSet(void);
00124   AREXPORT bool factorySet(void);
00125 
00126   AREXPORT bool panTilt(double pdeg, double tdeg);
00127 
00128   AREXPORT bool pan(double deg) { return panTilt(deg, myTilt); }
00129   AREXPORT bool panRel(double deg) { return panTilt(myPan+deg, myTilt); }
00130   AREXPORT bool tilt(double deg) { return panTilt(myPan, deg); }
00131   AREXPORT bool tiltRel(double deg) { return panTilt(myPan, myTilt+deg); }
00132   AREXPORT bool panTiltRel(double pdeg, double tdeg) { return panTilt(myPan+pdeg, myTilt+tdeg); }
00133 
00135   AREXPORT bool limitEnforce(bool val);
00137   AREXPORT bool immedExec(void);
00139   AREXPORT bool slaveExec(void);
00141   AREXPORT bool awaitExec(void);
00143   AREXPORT bool haltAll(void);
00145   AREXPORT bool haltPan(void);
00147   AREXPORT bool haltTilt(void);
00148 
00149   AREXPORT virtual double getMaxPosPan(void) const { return MAX_PAN; }
00150   AREXPORT virtual double getMaxNegPan(void) const { return MIN_PAN; }
00151   AREXPORT virtual double getMaxPosTilt(void) const { return MAX_TILT; }
00152   AREXPORT virtual double getMaxNegTilt(void) const { return MIN_TILT; }
00153   AREXPORT double getMaxPanSlew(void) { return MAX_PAN_SLEW; }
00154   AREXPORT double getMinPanSlew(void) { return MIN_PAN_SLEW; }
00155   AREXPORT double getMaxTiltSlew(void) { return MAX_TILT_SLEW; }
00156   AREXPORT double getMinTiltSlew(void) { return MIN_TILT_SLEW; }
00157   AREXPORT double getMaxPanAccel(void) { return MAX_PAN_ACCEL; }
00158   AREXPORT double getMinPanAccel(void) { return MIN_PAN_ACCEL; }
00159   AREXPORT double getMaxTiltAccel(void) { return MAX_TILT_ACCEL; }
00160   AREXPORT double getMinTiltAccel(void) { return MIN_TILT_ACCEL; }
00161 
00163   AREXPORT bool initMon(double deg1, double deg2, double deg3, double deg4);
00165   AREXPORT bool enMon(void);
00167   AREXPORT bool disMon(void);
00168 
00170   AREXPORT bool offStatPower(void);
00172   AREXPORT bool regStatPower(void);
00174   AREXPORT bool lowStatPower(void);
00176   AREXPORT bool highMotPower(void);
00178   AREXPORT bool regMotPower(void);
00180   AREXPORT bool lowMotPower(void);
00181 
00183   AREXPORT bool panAccel(double deg);
00185   AREXPORT bool tiltAccel(double deg);
00186 
00188   AREXPORT bool basePanSlew(double deg);
00190   AREXPORT bool baseTiltSlew(double deg);
00191 
00193   AREXPORT bool upperPanSlew(double deg);
00195   AREXPORT bool lowerPanSlew(double deg);
00197   AREXPORT bool upperTiltSlew(double deg);
00199   AREXPORT bool lowerTiltSlew(double deg);
00200 
00202   AREXPORT bool indepMove(void);
00204   AREXPORT bool velMove(void);
00205 
00207   AREXPORT bool panSlew(double deg);
00209   AREXPORT bool tiltSlew(double deg);
00210 
00212   AREXPORT bool panSlewRel(double deg) { return panSlew(myPanSlew+deg); }
00214   AREXPORT bool tiltSlewRel(double deg) { return tiltSlew(myTiltSlew+deg); }
00215 
00216   virtual double getPan(void) const { return myPan; }
00217   virtual double getTilt(void) const { return myTilt; }
00218 
00220   double getPanSlew(void) { return myPanSlew; }
00222   double getTiltSlew(void) { return myTiltSlew; }
00224   double getBasePanSlew(void) { return myBasePanSlew; }
00226   double getBaseTiltSlew(void) { return myBaseTiltSlew; }
00228   double getPanAccel(void) { return myPanAccel; }
00230   double getTiltAccel(void) { return myTiltAccel; }
00231 
00232   enum {
00233     MAX_PAN = 158, 
00234     MIN_PAN = -158, 
00235     MAX_TILT = 30, 
00236     MIN_TILT = -46, 
00237     MAX_PAN_SLEW = 149, 
00238     MIN_PAN_SLEW = 2, 
00239     MAX_TILT_SLEW = 149, 
00240     MIN_TILT_SLEW = 2, 
00241 // These aren't correct, because the manual doesn't specify
00242 // the min/max acceleration
00243     MAX_PAN_ACCEL = 102, 
00244     MIN_PAN_ACCEL = 2, 
00245     MAX_TILT_ACCEL = 102, 
00246     MIN_TILT_ACCEL = 2, 
00247   };
00248 protected:
00249   ArRobot *myRobot;
00250   ArDPPTUPacket myPacket;
00251   void preparePacket(void); 
00252   double myPan;
00253   double myTilt;
00254   double myPanSlew;
00255   double myTiltSlew;
00256   double myBasePanSlew;
00257   double myBaseTiltSlew;
00258   double myPanAccel;
00259   double myTiltAccel;
00260   static const double CONVERT; 
00261 };
00262 
00263 #endif // ARDPPTU_H
00264 

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