Korebot.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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;
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
00124
00125
00126
00127
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 };
00162
00163
00164
00165
00166 #endif
00167
00168
00169
00170
00171