SeaBee.H

Go to the documentation of this file.
00001 /*!@file BeoSub/SeaBee.H An autonomous submarine with one ballast */
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: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/BeoSub/SeaBee.H $
00035 // $Id: SeaBee.H 8521 2007-06-28 17:45:49Z rjpeters $
00036 //
00037 
00038 #ifndef BEOSUBTWO_H_DEFINED
00039 #define BEOSUBTWO_H_DEFINED
00040 
00041 #include "BeoSub/BeoSub.H"
00042 #include "Devices/BeoChip.H"
00043 
00044 
00045 //! Definition and access functions for the BeoSub
00046 /*! BeoSub is an autonomous visually-guided submarine. This class
00047   impoements the highl-evel functionality, relying on low-level
00048   drivers to handle motor activation, compass reading, etc */
00049 class SeaBee: public BeoSub
00050 {
00051 public:
00052   // ######################################################################
00053   /*! @name Constructors and Destructors */
00054   //@{
00055 
00056   //! Constructor
00057   SeaBee(OptionManager& mgr);
00058 
00059   //! Destructor
00060   ~SeaBee();
00061 
00062   //@}
00063 
00064         void test();
00065 
00066   // ######################################################################
00067   /*! @name mid-level overloads */
00068   //@{
00069 
00070   //! Advance the sub by some distance in meters
00071   /*! This is an overload of BeoSub::advanceRel() which ensures we
00072     turn off the heading PID during the advance */
00073   virtual void advanceRel(const float relDist, const bool stop = true);
00074 
00075   //! Strafes the sub by some distance in meters
00076   /*! This is an overload of BeoSub::strafeRel() which ensures we turn
00077     the heading PID off during the strafe */
00078 
00079   ////////////////////////////////////////////////////////////////
00080   void turnOpen(Angle ang, bool b) ;
00081 
00082   void dropMarker(bool b) ;
00083   Image<PixRGB <byte> > grabImage(BeoSubCamera bsc) const;
00084   /////////////////////////////////////////////////
00085   //@}
00086 
00087   // ######################################################################
00088   /*! @name Low-level access functions */
00089   //@{
00090 
00091   //! Activate the thrusters
00092   /*! Values should be between -1.0 (full reverse) and 1.0 (full
00093     forward), 0.0 being no motion */
00094   void thrust(const float leftval, const float rightval);
00095   void dive(const float leftval, const float rightval);
00096 
00097   //! Get the current thruster settings
00098   void getThrusters(float& leftval, float& rightval) const;
00099   void getDiveThrusters(float& leftval, float& rightval) const;
00100 
00101 
00102   //@}
00103 
00104   // **********************************************************************
00105   /*! closed-loop control */
00106 private:
00107   void updateThrusters();
00108   void updateDepth(const float depth);
00109   float PIDTransVel, TransVelCommand;
00110 public:
00111   void setTransVel(const float desired);
00112 
00113   // ######################################################################
00114   /*! @name PID control */
00115   //@{
00116 
00117   //@}
00118 
00119   // ######################################################################
00120   /*! @name Miscellaneous */
00121   //@{
00122 
00123 
00124   //@}
00125 
00126   // ######################################################################
00127   /*! @name For internal use by our listeners only -- do not call */
00128   //@{
00129 
00130 protected:
00131 //   NModelParam<int> itsLeftVThrusterServoNum;  //!< servo num for left thruster
00132 //   NModelParam<int> itsRightVThrusterServoNum; //!< servo num for right thruster
00133 
00134 //   NModelParam<int> itsLeftHThrusterServoNum; //!< servo num for left-horizontal thruster
00135 
00136 //   NModelParam<int> itsRightHThrusterServoNum; //!< servo num for right-horizontal thruster
00137 
00138   nub::soft_ref<BeoChip> itsBeo;             //!< our beochip
00139 
00140   float itsThrustLeftV, itsThrustRightV, itsThrustLeftH, itsThrustRightH;       //!< our current thruster settings
00141 
00142   float itsDiveSetting;
00143 
00144   virtual void start1(); //!< get started, before our subcomponents start
00145   virtual void start2(); //!< get started, after our subcomponents have started
00146   virtual void stop1();
00147 
00148 private:
00149   //! Dispatch a BeoChip event
00150   void dispatchBeoChipEvent(const BeoChipEventType t,
00151                             const int valint,
00152                             const float valfloat);
00153 
00154   friend class BeoSubListener;
00155 };
00156 
00157 
00158 
00159 
00160 
00161 
00162 #endif
00163 
00164 // ######################################################################
00165 /* So things look consistent in everyone's emacs... */
00166 /* Local Variables: */
00167 /* indent-tabs-mode: nil */
00168 /* End: */
Generated on Sun May 8 08:04:33 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3