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 ARRATIOINPUTKEYDRIVE_H 00028 #define ARRATIOINPUTKEYDRIVE_H 00029 00030 #include "ariaTypedefs.h" 00031 #include "ArAction.h" 00032 #include "ArFunctor.h" 00033 #include "ArActionRatioInput.h" 00034 00035 00037 00041 class ArRatioInputKeydrive 00042 { 00043 public: 00045 ArRatioInputKeydrive(ArRobot *robot, ArActionRatioInput *input, 00046 int priority = 25, double velIncrement = 5); 00048 virtual ~ArRatioInputKeydrive(); 00050 void takeKeys(void); 00052 void giveUpKeys(void); 00054 void up(void); 00056 void down(void); 00058 void left(void); 00060 void right(void); 00062 void space(void); 00064 ArFunctor *getFireCB(void) { return &myFireCB; } 00065 protected: 00066 void activate(void); 00067 void deactivate(void); 00068 void fireCallback(void); 00069 ArFunctorC<ArRatioInputKeydrive> myUpCB; 00070 ArFunctorC<ArRatioInputKeydrive> myDownCB; 00071 ArFunctorC<ArRatioInputKeydrive> myLeftCB; 00072 ArFunctorC<ArRatioInputKeydrive> myRightCB; 00073 ArFunctorC<ArRatioInputKeydrive> mySpaceCB; 00074 00075 double myPrinting; 00076 double myTransRatio; 00077 double myRotRatio; 00078 double myThrottle; 00079 ArRobot *myRobot; 00080 bool myHaveKeys; 00081 double myVelIncrement; 00082 ArActionRatioInput *myInput; 00083 ArFunctorC<ArRatioInputKeydrive> myFireCB; 00084 ArFunctorC<ArRatioInputKeydrive> myActivateCB; 00085 ArFunctorC<ArRatioInputKeydrive> myDeactivateCB; 00086 }; 00087 00088 00089 #endif // ARRATIOINPUTKEYDRIVE_H