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 ARPTZ_H 00028 #define ARPTZ_H 00029 00030 #include "ariaTypedefs.h" 00031 #include "ArFunctor.h" 00032 #include "ArCommands.h" 00033 00034 class ArRobot; 00035 class ArBasePacket; 00036 class ArRobotPacket; 00037 class ArDeviceConnection; 00038 00039 00041 00083 class ArPTZ 00084 { 00085 public: 00086 ArPTZ(ArRobot *robot); 00088 virtual ~ArPTZ(); 00089 00091 virtual bool init(void) = 0; 00092 00094 virtual bool pan(int degrees) = 0; 00096 virtual bool panRel(int degrees) = 0; 00097 00099 virtual bool tilt(int degrees) = 0; 00101 virtual bool tiltRel(int degrees) = 0; 00102 00104 virtual bool panTilt(int degreesPan, int degreesTilt) = 0; 00106 virtual bool panTiltRel(int degreesPan, int degreesTilt) = 0; 00107 00109 virtual bool canZoom(void) const = 0; 00110 00112 virtual bool zoom(int zoomValue) { return false; } 00114 virtual bool zoomRel(int zoomValue) { return false; } 00115 00117 virtual int getPan(void) const = 0; 00119 virtual int getTilt(void) const = 0; 00121 virtual int getZoom(void) const { return 0; } 00122 00124 virtual bool canGetRealPanTilt(void) const { return false; } 00125 // The angle the camera says its at (not needed and was confusing, 00126 // just use getPan) 00127 // virtual int getRealPan(void) const { return 0; } 00128 // The angle the camera says its at (not needed and was confusing, 00129 // just use getTilt) 00130 //virtual int getRealTilt(void) const { return 0; } 00131 00133 virtual bool canGetRealZoom(void) const { return false; } 00134 // The zoom the camera says its at (not needed and was confusing, 00135 // just use getZoom) 00136 // virtual int getRealZoom(void) const { return 0; } 00137 00139 virtual int getMaxPosPan(void) const = 0; 00141 virtual int getMaxNegPan(void) const = 0; 00143 virtual int getMaxPosTilt(void) const = 0; 00145 virtual int getMaxNegTilt(void) const = 0; 00147 virtual int getMaxZoom(void) const { return 0; } 00149 virtual int getMinZoom(void) const { return 0; } 00150 00153 virtual bool setGain(int gain) const { return false; } 00155 virtual int getGain(int gain) const { return 0; } 00157 virtual bool canSetGain(void) const { return false; } 00158 00161 virtual bool setFocus(int focus) const { return false; } 00163 virtual int getFocus(int focus) const { return 0; } 00165 virtual bool canSetFocus(void) const { return false; } 00166 00170 virtual bool setDeviceConnection(ArDeviceConnection *connection, 00171 bool driveFromRobotLoop = true); 00173 virtual ArDeviceConnection *getDeviceConnection(void); 00175 virtual bool setAuxPort(int auxPort); 00177 virtual int getAuxPort(void) { return myAuxPort; } 00179 00187 virtual ArBasePacket *readPacket(void) { return NULL; } 00188 00190 virtual bool sendPacket(ArBasePacket *packet); 00192 00202 virtual bool packetHandler(ArBasePacket *packet) { return false; } 00203 00205 00213 virtual bool robotPacketHandler(ArRobotPacket *packet); 00214 00216 virtual void connectHandler(void); 00218 virtual void sensorInterpHandler(void); 00219 protected: 00220 ArRobot *myRobot; 00221 ArDeviceConnection *myConn; 00222 ArFunctorC<ArPTZ> myConnectCB; 00223 ArFunctorC<ArPTZ> mySensorInterpCB; 00224 int myAuxPort; 00225 ArCommands::Commands myAuxTxCmd; 00226 ArCommands::Commands myAuxRxCmd; 00227 ArRetFunctor1C<bool, ArPTZ, ArRobotPacket *> myRobotPacketHandlerCB; 00228 }; 00229 00230 #endif // ARPTZ_H