Roboshark / Mbed 2 deprecated Roboshark_V7

Dependencies:   mbed

Fork of Roboshark_V62 by Roboshark

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Controller.h Source File

Controller.h

00001 #ifndef CONTROLLER_H_
00002 #define CONTROLLER_H_
00003 #include <cstdlib>
00004 #include <mbed.h>
00005 #include "EncoderCounter.h"
00006 #include "LowpassFilter.h"
00007 
00008 class Controller
00009 {
00010 
00011 public:
00012 
00013     Controller(PwmOut& pwmLeft, PwmOut& pwmRight,
00014                EncoderCounter& counterLeft, EncoderCounter& counterRight);
00015 
00016     virtual ~Controller();
00017     void setDesiredSpeedLeft(float desiredSpeedLeft);
00018     void setDesiredSpeedRight(float desiredSpeedRight);
00019     float getSpeedLeft();
00020     float getSpeedRight();
00021     float getIntegralLeft();
00022     float getIntegralRight();
00023     float getProportionalLeft();
00024     float getProportionalRight();
00025 
00026 private:
00027 
00028     static const float PERIOD;
00029     static const float COUNTS_PER_TURN;
00030     static const float LOWPASS_FILTER_FREQUENCY;
00031     static const float KN;
00032     static const float KP;
00033     static const float KI;
00034     static const float I_MAX;    
00035     static const float MAX_VOLTAGE;
00036     static const float MIN_DUTY_CYCLE;
00037     static const float MAX_DUTY_CYCLE;
00038 
00039     PwmOut&            pwmLeft;
00040     PwmOut&            pwmRight;
00041     EncoderCounter&    counterLeft;
00042     EncoderCounter&    counterRight;
00043     short              previousValueCounterLeft;
00044     short              previousValueCounterRight;
00045     LowpassFilter      speedLeftFilter;
00046     LowpassFilter      speedRightFilter;
00047     float              desiredSpeedLeft;
00048     float              desiredSpeedRight;
00049     float              actualSpeedLeft;
00050     float              actualSpeedRight;
00051     float              iSumLeft;
00052     float              iSumRight;
00053     Ticker             ticker;
00054     
00055     void               run();
00056 
00057 };
00058 
00059 #endif /* CONTROLLER_H_ */
00060 
00061 
00062 
00063 
00064 
00065 
00066