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

ArDPPTU.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 ARDPPTU_H
00028 #define ARDPPTU_H
00029 
00030 #include "ariaTypedefs.h"
00031 #include "ArRobot.h"
00032 #include "ArPTZ.h"
00033 
00044 
00045 class ArDPPTUCommands
00046 {
00047 public:
00048   enum {
00049     DELIM = 0x20, 
00050     INIT = 0x40, 
00051     ACCEL = 0x61, 
00052     BASE = 0x62, 
00053     CONTROL = 0x63, 
00054     DISABLE = 0x64, 
00055     ENABLE = 0x65, 
00056     FACTORY = 0x66, 
00057     HALT = 0x68, 
00058     IMMED = 0x69, 
00059     LIMIT = 0x6C, 
00060     MONITOR = 0x6D, 
00061     OFFSET = 0x6F, 
00062     PAN = 0x70, 
00063     RESET = 0x72, 
00064     SPEED = 0x73, 
00065     TILT = 0x74, 
00066     UPPER = 0x75, 
00067     VELOCITY = 0x76 
00068   };
00069 
00070 };
00071 
00073 
00078 class ArDPPTUPacket: public ArBasePacket
00079 {
00080 public:
00082   ArDPPTUPacket(ArTypes::UByte2 bufferSize = 30);
00084   virtual ~ArDPPTUPacket();
00085 
00086   virtual void byte2ToBuf(int val);
00087 
00088   virtual void finalizePacket(void);
00089 
00090 protected:
00091 };
00092 
00094 class ArDPPTU : public ArPTZ
00095 {
00096 public:
00098   ArDPPTU(ArRobot *robot);
00100   virtual ~ArDPPTU();
00101 
00102   bool init(void);
00103 
00104   bool canZoom(void) const { return 0; }
00105 
00107   bool blank(void);
00108 
00110   bool resetCalib(void);
00112   bool disableReset(void);
00114   bool resetTilt(void);
00116   bool resetPan(void);
00118   bool resetAll(void);
00119 
00121   bool saveSet(void);
00123   bool restoreSet(void);
00125   bool factorySet(void);
00126 
00127   bool panTilt(int pdeg, int tdeg);
00128 
00129   bool pan(int deg) { return panTilt(deg, myTilt); }
00130   bool panRel(int deg) { return panTilt(myPan+deg, myTilt); }
00131   bool tilt(int deg) { return panTilt(myPan, deg); }
00132   bool tiltRel(int deg) { return panTilt(myPan, myTilt+deg); }
00133   bool panTiltRel(int pdeg, int tdeg) { return panTilt(myPan+pdeg, myTilt+tdeg); }
00134 
00136   bool limitEnforce(bool val);
00138   bool immedExec(void);
00140   bool slaveExec(void);
00142   bool awaitExec(void);
00144   bool haltAll(void);
00146   bool haltPan(void);
00148   bool haltTilt(void);
00149 
00150   virtual int getMaxPosPan(void) const { return MAX_PAN; }
00151   virtual int getMaxNegPan(void) const { return MIN_PAN; }
00152   virtual int getMaxPosTilt(void) const { return MAX_TILT; }
00153   virtual int getMaxNegTilt(void) const { return MIN_TILT; }
00154   int getMaxPanSlew(void) { return MAX_PAN_SLEW; }
00155   int getMinPanSlew(void) { return MIN_PAN_SLEW; }
00156   int getMaxTiltSlew(void) { return MAX_TILT_SLEW; }
00157   int getMinTiltSlew(void) { return MIN_TILT_SLEW; }
00158   int getMaxPanAccel(void) { return MAX_PAN_ACCEL; }
00159   int getMinPanAccel(void) { return MIN_PAN_ACCEL; }
00160   int getMaxTiltAccel(void) { return MAX_TILT_ACCEL; }
00161   int getMinTiltAccel(void) { return MIN_TILT_ACCEL; }
00162 
00164   bool initMon(int deg1, int deg2, int deg3, int deg4);
00166   bool enMon(void);
00168   bool disMon(void);
00169 
00171   bool offStatPower(void);
00173   bool regStatPower(void);
00175   bool lowStatPower(void);
00177   bool highMotPower(void);
00179   bool regMotPower(void);
00181   bool lowMotPower(void);
00182 
00184   bool panAccel(int deg);
00186   bool tiltAccel(int deg);
00187 
00189   bool basePanSlew(int deg);
00191   bool baseTiltSlew(int deg);
00192 
00194   bool upperPanSlew(int deg);
00196   bool lowerPanSlew(int deg);
00198   bool upperTiltSlew(int deg);
00200   bool lowerTiltSlew(int deg);
00201 
00203   bool indepMove(void);
00205   bool velMove(void);
00206 
00208   bool panSlew(int deg);
00210   bool tiltSlew(int deg);
00211 
00213   bool panSlewRel(int deg) { return panSlew(myPanSlew+deg); }
00215   bool tiltSlewRel(int deg) { return tiltSlew(myTiltSlew+deg); }
00216 
00217   virtual int getPan(void) const { return myPan; }
00218   virtual int getTilt(void) const { return myTilt; }
00219 
00221   int getPanSlew(void) { return myPanSlew; }
00223   int getTiltSlew(void) { return myTiltSlew; }
00225   int getBasePanSlew(void) { return myBasePanSlew; }
00227   int getBaseTiltSlew(void) { return myBaseTiltSlew; }
00229   int getPanAccel(void) { return myPanAccel; }
00231   int getTiltAccel(void) { return myTiltAccel; }
00232 
00233   enum {
00234     MAX_PAN = 158, 
00235     MIN_PAN = -158, 
00236     MAX_TILT = 30, 
00237     MIN_TILT = -46, 
00238     MAX_PAN_SLEW = 149, 
00239     MIN_PAN_SLEW = 2, 
00240     MAX_TILT_SLEW = 149, 
00241     MIN_TILT_SLEW = 2, 
00242 // These aren't correct, because the manual doesn't specify
00243 // the min/max acceleration
00244     MAX_PAN_ACCEL = 102, 
00245     MIN_PAN_ACCEL = 2, 
00246     MAX_TILT_ACCEL = 102, 
00247     MIN_TILT_ACCEL = 2, 
00248   };
00249 protected:
00250   ArRobot *myRobot;
00251   ArDPPTUPacket myPacket;
00252   void preparePacket(void); 
00253   int myPan;
00254   int myTilt;
00255   int myPanSlew;
00256   int myTiltSlew;
00257   int myBasePanSlew;
00258   int myBaseTiltSlew;
00259   int myPanAccel;
00260   int myTiltAccel;
00261   static const double CONVERT; 
00262 };
00263 
00264 #endif // ARDPPTU_H
00265 

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