MovementController.H

Go to the documentation of this file.
00001 /*!@file SeaBee/MovementController.H  Control motors and pid */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003   //
00005 // by the 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: Mike Montalbo mmontalbo[at]gmail[dot].com
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/SeaBee/MovementController.H $
00035 // $Id: MovementController.H 10794 2009-02-08 06:21:09Z itti $
00036 //
00037 
00038 #ifndef MovementController_H_DEFINED
00039 #define MovementController_H_DEFINED
00040 
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelOptionDef.H"
00043 #include "Component/ModelParam.H"
00044 #include "Component/OptionManager.H"
00045 #include "Image/Point2D.H"
00046 #include "SubController.H"
00047 
00048 const ModelOptionCateg MOC_SeaBee_Movement_Controller = {
00049   MOC_SORTPRI_3, "SeaBee Movement Controller related options" };
00050 
00051 static const ModelOptionDef OPT_DepthErrThresh =
00052   { MODOPT_ARG(int), "DepthErrThresh", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00053     "Error threshold for depth",
00054     "depth-err-thresh", '\0', "<int>", "0" };
00055 
00056 static const ModelOptionDef OPT_HeadingErrThresh =
00057   { MODOPT_ARG(int), "HeadingErrThresh", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00058     "Error threshold for heading",
00059     "heading-err-thresh", '\0', "<int>", "0" };
00060 
00061 static const ModelOptionDef OPT_DiveValue =
00062   { MODOPT_ARG(int), "DiveValue", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00063     "Depth to dive",
00064     "depth-value", '\0', "<int>", "0" };
00065 
00066 static const ModelOptionDef OPT_GoStraightTime =
00067   { MODOPT_ARG(int), "GoStraightTime", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00068     "Time to go straight for",
00069     "straight-time", '\0', "<int>", "0" };
00070 
00071 static const ModelOptionDef OPT_SpeedValue =
00072   { MODOPT_ARG(int), "SpeedValue", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00073     "Value for speed",
00074     "speed-value", '\0', "<int>", "0" };
00075 
00076 static const ModelOptionDef OPT_HeadingValue =
00077   { MODOPT_ARG(int), "HeadingValue", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00078     "Value for heading",
00079     "heading-value", '\0', "<int>", "0" };
00080 
00081 static const ModelOptionDef OPT_TimeoutValue =
00082   { MODOPT_ARG(int), "TimeoutValue", &MOC_SeaBee_Movement_Controller, OPTEXP_SAVE,
00083     "Value for timeout",
00084     "timeout-value", '\0', "<int>", "0" };
00085 
00086 
00087 // ######################################################################
00088 class MovementController : public ModelComponent
00089 {
00090 public:
00091 
00092   // ######################################################################
00093   /*! @name Constructors and Destructors */
00094   //@{
00095 
00096   //! Constructor
00097   MovementController(OptionManager& mgr,
00098                      nub::soft_ref<SubController> subController,
00099                      const std::string& descrName = "MovementController",
00100                      const std::string& tagName = "MovementController");
00101 
00102   //! Destructor
00103   ~MovementController();
00104 
00105   bool dive(int depth, bool relative = false, int timeout = 0);
00106   bool goStraight(int speed, int time);
00107   bool setHeading(int heading, bool relative = false, int timeout = 0);
00108   int trackPipe(const Point2D<int>& pointToTrack, const Point2D<int>& desiredPoint);
00109 
00110   void paramChanged(ModelParamBase* const param,
00111                     const bool valueChanged,
00112                     ParamClient::ChangeStatus* status);
00113 
00114   //@}
00115 
00116   // ######################################################################
00117   /*! @name member functions */
00118   //@{
00119 
00120   OModelParam<int>  itsDepthErrThresh;
00121   OModelParam<int>  itsHeadingErrThresh;
00122 
00123   NModelParam<float> pipeP;
00124   NModelParam<float> pipeI;
00125   NModelParam<float> pipeD;
00126   PID<float> itsPipePID;
00127 
00128   OModelParam<int>  setDiveValue;
00129   OModelParam<int>  setGoStraightTimeValue;
00130   OModelParam<int>  setSpeedValue;
00131   OModelParam<int>  setHeadingValue;
00132   NModelParam<bool>  setRelative;
00133   OModelParam<int>  setTimeout;
00134 
00135 private:
00136 
00137   nub::soft_ref<SubController> itsSubController;
00138 
00139 };
00140 
00141 #endif
00142 
00143 // ######################################################################
00144 /* So things look consistent in everyone's emacs... */
00145 /* Local Variables: */
00146 /* indent-tabs-mode: nil */
00147 /* End: */
Generated on Sun May 8 08:42:14 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3