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

ArServerModeRatioDrive.h

Go to the documentation of this file.
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 ARSERVERMODERATIODRIVE_H
00027 #define ARSERVERMODERATIODRIVE_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "Aria.h"
00031 #include "ArServerMode.h"
00032 
00033 class ArServerHandlerCommands;
00034 
00035 class ArServerModeRatioDrive : public ArServerMode
00036 {
00037 public:
00039   AREXPORT ArServerModeRatioDrive(ArServerBase *server, ArRobot *robot,
00040                                   bool takeControlOnJoystick = true,
00041                                   bool useComputerJoystick = true, 
00042                                   bool useRobotJoystick = true, 
00043                                   bool useServerCommands = true, 
00044                                   const char *name = "ratioDrive");
00046   AREXPORT virtual ~ArServerModeRatioDrive();
00047   AREXPORT virtual void activate(void);
00048   AREXPORT virtual void deactivate(void);
00050   AREXPORT void addControlCommands(ArServerHandlerCommands *handlerCommands);
00052   AREXPORT void ratioDrive(double transRatio, double rotRatio, 
00053                            double throttleRatio);
00055   AREXPORT void addToConfig(ArConfig *config, const char *section);
00056   AREXPORT virtual void userTask(void);
00057   AREXPORT virtual ArActionGroup *getActionGroup(void) { return &myRatioDriveGroup;}
00058   ArActionRatioInput *getActionRatioInput(void) { return myRatioAction; }
00060   AREXPORT void setSafeDriving(bool safe, bool internal = false);
00062   AREXPORT bool getSafeDriving(void);
00064   AREXPORT void setUseLocationDependentDevices(
00065           bool useLocationDependentDevices, bool internal = false);
00067   AREXPORT bool getUseLocationDependentDevices(void);
00068 protected:
00069   AREXPORT void serverRatioDrive(ArServerClient *client,
00070                                     ArNetPacket *packet);
00071   AREXPORT void serverSetSafeDrive(ArServerClient *client,
00072                                       ArNetPacket *packet);
00073   AREXPORT void serverGetSafeDrive(ArServerClient *client,
00074                                       ArNetPacket *packet);
00075   AREXPORT void serverSafeDrivingEnable(void);
00076   AREXPORT void serverSafeDrivingDisable(void);
00077   AREXPORT void ratioFireCallback(void);
00078   AREXPORT void joyUserTask(void);
00079   ArJoyHandler *myJoyHandler;
00080   ArRobotJoyHandler *myRobotJoyHandler;
00081 
00082   bool myTakeControlOnJoystick;
00083   bool myUseComputerJoystick;
00084   bool myUseRobotJoystick;
00085   bool myUseServerCommands;
00086   bool myPrinting;
00087   double myTransRatio;
00088   double myRotRatio;
00089   double myThrottleRatio;
00090 
00091   ArActionDeceleratingLimiter *myLimiterForward;
00092   ArActionDeceleratingLimiter *myLimiterBackward;
00093   ArRatioInputJoydrive *myJoydrive;
00094   ArRatioInputRobotJoydrive *myRobotJoydrive;
00095   ArActionRatioInput *myRatioAction;
00096   ArActionMovementParameters *myMovementParameters;
00097   ArActionGroup myRatioDriveGroup;
00098   bool myDriveSafely;
00099   bool myNewDriveSafely;
00100   bool myUseLocationDependentDevices;
00101 
00102   ArFunctorC<ArServerModeRatioDrive> myJoyUserTaskCB;
00103   ArFunctor2C<ArServerModeRatioDrive, ArServerClient *, ArNetPacket *> myServerSetSafeDriveCB;
00104   ArFunctor2C<ArServerModeRatioDrive, ArServerClient *, ArNetPacket *> myServerGetSafeDriveCB;
00105   ArFunctor2C<ArServerModeRatioDrive, ArServerClient *, ArNetPacket *> myServerRatioDriveCB;
00106   ArFunctorC<ArServerModeRatioDrive> myRatioFireCB;
00107   
00108   // for the simple commands
00109   ArServerHandlerCommands *myHandlerCommands;
00110   ArFunctorC<ArServerModeRatioDrive> myServerSafeDrivingEnableCB;
00111   ArFunctorC<ArServerModeRatioDrive> myServerSafeDrivingDisableCB;
00112 };
00113 
00114 
00115 #endif // ARNETMODERATIODRIVE_H

Generated on Tue Feb 20 10:51:50 2007 for ArNetworking by  doxygen 1.4.0