RangeSens.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00030 
00031 
00035 
00036 
00037 #ifndef __RANGE_SENSOR_H_
00038 #define __RANGE_SENSOR_H_
00039 
00040 #ifdef MIP_HOST_APPLE
00041 #include <applePatch.h>
00042 #endif
00043 
00044 #include <stdlib.h>
00045 #include <string>
00046 #include <sstream>
00047 #include <vector>
00048 #include <assert.h>
00049 #include <pthread.h>
00050 
00051 #include <stdint.h>
00052 
00053 #include <baselib.h>
00054 #include <Resource.h>
00055 
00056 namespace MipResources{
00057 
00059 /* @{ */
00060 
00064 class RangeSensOptions : public Options {
00065  public:
00066   IntOption *useFixedBearings;
00067   
00068   RangeSensOptions();
00069   OptionGroupsType getGroup();
00070 
00071   string getObjectName() const {
00072    return "RangeSensOptions";
00073   }
00074 };
00075 
00086 class RangeSensPar{
00087  private:
00088   Decimal  _linRangeMin;  
00089   Decimal  _linRangeMax;  
00090   Decimal  _linRes;    
00091   Angle  _angRangeMax;  
00092   Angle  _angRangeMin;  
00093   Angle  _angRes;    
00094   uint _numRays;    
00095   Decimal  _rate;     
00096   Pose   _pose;     
00097   string  _name;
00098  protected:
00101   void setLinRangeMin(Decimal value);
00102   
00105   void setLinRangeMax(Decimal value);
00106   
00109   void setLinRes(Decimal value);
00110   
00113   void setAngRangeMax(Angle value);
00114   
00117   void setAngRangeMin(Angle value);
00118   
00121   void setAngRes(Angle value);
00122   
00125   void setNumRays(uint32_t value);
00126   
00129   void setRate(Decimal value);
00130   
00132   void setPose(Pose value);
00133   
00135   void setName(string value);
00136   
00137  public:
00139   RangeSensPar ();
00140   
00142   RangeSensPar(const RangeSensPar &s);
00143   
00145   RangeSensPar& operator=(const RangeSensPar& s);
00146   
00148   Decimal linRangeMax();
00149   
00151   Decimal linRangeMin();
00152   
00154   Decimal linRes();
00155   
00157   Angle angRangeMax();
00158   
00160   Angle angRangeMin();
00161   
00163   Angle angRes();
00164   
00166   int numRays();
00167   
00169   Decimal rate();
00170   
00172   Pose pose();
00173   
00175   string name();
00176   
00179   inline string print();
00180 };
00181 
00182 
00183 
00194 class RangeSensmmPar{
00195  private:
00196   UCoordmm _linRangeMin;  
00197   UCoordmm _linRangeMax;  
00198   UCoordmm _linRes;    
00199   Anglem  _angRangeMax;  
00200   Anglem  _angRangeMin;  
00201   Anglem  _angRes;    
00202   uint32_t _numRays;    
00203   Decimal  _rate;     
00204   Pose   _pose;     
00205   string  _name;
00206  protected:
00209   void setLinRangeMin(UCoordmm value);
00210   
00213   void setLinRangeMax(UCoordmm value);
00214   
00217   void setLinRes(UCoordmm value);
00218   
00221   void setAngRangeMax(Anglem value);
00222   
00225   void setAngRangeMin(Anglem value);
00226   
00229   void setAngRes(Anglem value);
00230   
00233   void setNumRays(uint32_t value);
00234   
00237   void setRate(Decimal value);
00238   
00240   void setPose(Pose value);
00241   
00243   void setName(string value);
00244   
00245  public:
00247   RangeSensmmPar ();
00248   
00250   RangeSensmmPar(const RangeSensmmPar &s);
00251   
00253   RangeSensmmPar& operator=(const RangeSensmmPar& s);
00254   
00256   UCoordmm linRangeMax();
00257   
00259   UCoordmm linRangeMin();
00260   
00262   UCoordmm linRes();
00263   
00265   Anglem angRangeMax();
00266   
00268   Anglem angRangeMin();
00269   
00271   Anglem angRes();
00272   
00274   int numRays();
00275   
00277   Decimal rate();
00278   
00280   Pose pose();
00281   
00283   string name();
00284   
00287   inline string print();
00288 };
00289 
00290     using namespace MipBaselib;
00294 class RangeSens : public Resource{
00295 
00296  private:
00297   bool _scanning;
00298   
00299  protected:
00300   RangeSensPar *_par;   
00301   RangeSensmmPar *_parmm; 
00302   Scan _scan;      
00303   bool on;        
00304   
00305   vector<Angle>  *_fixedBearings; 
00306   vector<Anglem> *_fixedBearingsmm;
00307   bool useFixedBearings;      
00308   
00309   RangeSensOptions _rangeSensOptions; 
00310   
00311   /*batch scanning*/
00313   virtual Scan _singleScan()=0;
00314   
00315   /*start stop continuous scanning*/
00318   virtual void _startScan(unsigned int num)=0;
00319   
00321   virtual void _stopScan()=0;
00322   
00323  public:
00325   virtual ResourcePlate getPlate() const =0;
00326   
00328 //   RangeSens();
00329   
00331   RangeSens(int argc, const char* argv[]);
00332   
00334   ~RangeSens();
00335   
00339   RangeSensPar* par();
00340   
00344   RangeSensmmPar* parmm();
00345   
00350   bool getScanType(ScanTypes& type);
00351   
00352   /*updated scanning*/
00356   bool updatedScan(Scan& s);
00357   
00358   /*start stop continuous scanning*/
00361   void startScan(unsigned int num);
00362   
00364   void stopScan();
00365   
00366   /*get a scan in a continuous scanning*/
00372   bool storedScan(Scan& s,Time timeout);
00373   
00376   void getFixedBearings();
00377 };
00378 
00379  /* @} */
00380  
00381 };// end namespace MipResources{
00382 
00383 
00384 #endif
00385 
00386 
00387 
00388 
00389 
00390 
00391 

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6