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 ARACTIONKEYDRIVE_H 00028 #define ARACTIONKEYDRIVE_H 00029 00030 #include "ariaTypedefs.h" 00031 #include "ArAction.h" 00032 #include "ArFunctor.h" 00033 00034 class ArRobot; 00035 00037 class ArActionKeydrive : public ArAction 00038 { 00039 public: 00041 ArActionKeydrive(const char *name = "keydrive", 00042 double transVelMax = 400, 00043 double turnAmountMax = 24, 00044 double velIncrement = 25, 00045 double turnIncrement = 8); 00047 virtual ~ArActionKeydrive(); 00048 virtual ArActionDesired *fire(ArActionDesired currentDesired); 00050 void setSpeeds(double transVelMax, double turnAmountMax); 00052 void setIncrements(double velIncrement, double turnIncrement); 00053 virtual ArActionDesired *getDesired(void) { return &myDesired; } 00054 virtual void setRobot(ArRobot *robot); 00055 virtual void activate(void); 00056 virtual void deactivate(void); 00058 void takeKeys(void); 00060 void giveUpKeys(void); 00062 void up(void); 00064 void down(void); 00066 void left(void); 00068 void right(void); 00070 void space(void); 00071 00072 protected: 00073 ArFunctorC<ArActionKeydrive> myUpCB; 00074 ArFunctorC<ArActionKeydrive> myDownCB; 00075 ArFunctorC<ArActionKeydrive> myLeftCB; 00076 ArFunctorC<ArActionKeydrive> myRightCB; 00077 ArFunctorC<ArActionKeydrive> mySpaceCB; 00078 // action desired 00079 ArActionDesired myDesired; 00080 // full speed 00081 double myTransVelMax; 00082 // full amount to turn 00083 double myTurnAmountMax; 00084 // amount to increment vel by on an up arrow or decrement on a down arrow 00085 double myVelIncrement; 00086 // amount to increment turn by on a left arrow or right arrow 00087 double myTurnIncrement; 00088 // amount we want to speed up 00089 double myDeltaVel; 00090 // amount we want to turn 00091 double myTurnAmount; 00092 // what speed we want to go 00093 double myDesiredSpeed; 00094 // if our speeds been reset 00095 bool mySpeedReset; 00096 }; 00097 00098 00099 #endif // ARACTIONKEYDRIVE_H