BeobotAction.H

Go to the documentation of this file.
00001 /*!@file Beobot/BeobotAction.H Motor actions for the Beobots */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // University of Southern California (USC) and the iLab at USC.         //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Beobot/BeobotAction.H $
00035 // $Id: BeobotAction.H 4663 2005-06-23 17:47:28Z rjpeters $
00036 //
00037 
00038 #ifndef BEOBOTACTION_H_DEFINED
00039 #define BEOBOTACTION_H_DEFINED
00040 
00041 #include "Util/Types.H"
00042 #include "Util/log.H"
00043 
00044 //! This class defined motor actions for the Beobots
00045 /*! Turn is between -1.0 (full left) and 1.0 (full right), speed is
00046     between -1.0 (full reverse) and 1.0 (full forward), and gear is 0
00047     (neutral), 1 or 2. */
00048 
00049 class BeobotAction {
00050 public:
00051   //! no arg constructor
00052   inline BeobotAction();
00053 
00054   //! constructor
00055   inline BeobotAction(const float t, const float s, const int g);
00056 
00057   //! copy constructor
00058   inline BeobotAction( const BeobotAction &other );
00059 
00060   //! Assignment constructor
00061   inline BeobotAction& operator=(const BeobotAction& other);
00062 
00063   //! access function
00064   inline float getTurn() const;
00065 
00066   //! access function
00067   inline float getSpeed() const;
00068 
00069   //! access function
00070   inline int getGear() const;
00071 
00072   //! access function
00073   inline void setTurn(const float t);
00074 
00075   //! access function
00076   inline void setSpeed(const float s);
00077 
00078   //! access function
00079   inline void setGear(const int g);
00080 
00081   //! destructor
00082   inline ~BeobotAction();
00083 
00084 private:
00085   float turn;
00086   float speed;
00087   int gear;
00088 };
00089 
00090 // ######################################################################
00091 // ######################################################################
00092 // ######################################################################
00093 // INLINE FUNCTIONS:
00094 // ######################################################################
00095 // ######################################################################
00096 // ######################################################################
00097 
00098 // ######################################################################
00099 inline BeobotAction::BeobotAction()
00100 { turn = 0.0F; speed = 0.0F; gear = 1; }
00101 
00102 // ######################################################################
00103 inline BeobotAction::BeobotAction( const BeobotAction& other )
00104 { turn = other.turn; speed = other.speed; gear = other.gear; }
00105 
00106 // ######################################################################
00107 inline  BeobotAction::BeobotAction(const float t, const float s, const int g)
00108 { setTurn(t); setSpeed(s); setGear(g); }
00109 
00110 // ######################################################################
00111 inline BeobotAction& BeobotAction::operator=(const BeobotAction& other)
00112 { turn = other.turn; speed = other.speed; gear = other.gear; return *this; }
00113 
00114 // ######################################################################
00115 inline BeobotAction::~BeobotAction()
00116 { }
00117 
00118 // ######################################################################
00119 inline float BeobotAction::getTurn() const
00120 { return turn; }
00121 
00122 // ######################################################################
00123 inline float BeobotAction::getSpeed() const
00124 { return speed; }
00125 
00126 // ######################################################################
00127 inline int BeobotAction::getGear() const
00128 { return gear; }
00129 
00130 // ######################################################################
00131 inline void BeobotAction::setTurn(const float t)
00132 {
00133   if (t < -1.0F || t > 1.0F) LERROR("Invalid value %f -- IGNORED", t);
00134   else turn = t;
00135 }
00136 
00137 // ######################################################################
00138 inline void BeobotAction::setSpeed(const float s)
00139 {
00140   if (s < -1.0F || s > 1.0F) LERROR("Invalid value %f -- IGNORED", s);
00141   else speed = s;
00142 }
00143 
00144 // ######################################################################
00145 inline void BeobotAction::setGear(const int g)
00146 {
00147   if (g < 0 || g > 2) LERROR("Invalid value %d -- IGNORED", g);
00148   else gear = g;
00149 }
00150 
00151 
00152 #endif
00153 
00154 // ######################################################################
00155 /* So things look consistent in everyone's emacs... */
00156 /* Local Variables: */
00157 /* indent-tabs-mode: nil */
00158 /* End: */
Generated on Sun May 8 08:04:26 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3