Korebot.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 
00032 
00033 
00034 
00035 
00036 #ifndef __KOREBOT_H_
00037 #define __KOREBOT_H_
00038 
00039 #include <stdlib.h>
00040 #include <stdio.h>
00041 #include <string.h>
00042 #include <math.h>
00043 #include <iostream>
00044 #include <fstream>
00045 
00046 #include <korebot/korebot.h>
00047 
00048 #include <baselib.h>
00049 #include "MotionModule.h"
00050 
00051 
00052 namespace MipResources{
00054  /* @{ */
00055 
00056 
00063 class KorebotPar : public DiffDrivePar{
00064  private:
00065   static const string  _korebotName;
00066   static const Decimal _maxWheelTurnRate = 3.78; /*Computed imposing 0.5 m/s */
00067   static const Decimal _leftDiam = 0.042;
00068   static const Decimal _rightDiam = 0.042;
00069   static const Decimal _axelTrack = 0.089;
00070   static const Decimal _encoderResol = 2764.8;
00071   
00072   string  _providedName(){return _korebotName;}
00073   Decimal _providedMaxWheelTurnRate(void){return _maxWheelTurnRate;}
00074   Decimal _providedLeftDiam(void){return _leftDiam;}
00075   Decimal _providedRightDiam(void){return _rightDiam;}
00076   Decimal _providedAxelTrack(void){return _axelTrack;}
00077   Decimal _providedEncoderResol(void){return _encoderResol;}
00078  public:
00080   KorebotPar(){
00081   }
00083   ~KorebotPar(){
00084   }
00085 };
00086 
00093 class KorebotVar : public DiffDriveVar{
00094  private:
00095   int _initMotor(knet_dev_t* hDev, bool right);
00096  public:
00097   knet_dev_t* dsPic;
00098   knet_dev_t* motor1;
00099   knet_dev_t* motor2;
00100   
00102   KorebotVar();
00103   
00106   virtual string getName(void){
00107    return "MotionKorebot";
00108   }
00109 };
00110 
00111 
00118 class Korebot : public DiffDrive{
00119  private:
00120   static const ResourcePlate _plate = MM_KOR_RES; 
00121   
00122  protected:
00123   /* PROMEMO from more abstract classes */
00124   /* UnicyclePar *_par; */
00125   /* UnicycleVar *_var; */
00126   /* DiffDrivePar *_ddPar; */
00127   /* DiffDriveVar *_ddVar; */
00128   KorebotPar *_korePar; 
00129   KorebotVar *_koreVar; 
00131  public:
00135   Korebot(int argc, const char* argv[]);
00136   
00138   ~Korebot();
00140   ResourcePlate getPlate() const {
00141    return _plate;
00142   }
00143 
00147   void setWheelCommands(Decimal leftAngVel, Decimal rightAngVel);
00148   
00151   DiffDriveEncoderReading getEncoders();
00152   
00154   void resetEncoders();
00155 };
00156 
00157 
00158 
00159  /* @} */
00160  
00161 };// end namespace MipResources{
00162 
00163 
00164 
00165 
00166 #endif
00167 
00168 
00169 
00170 
00171 

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