Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Versuch20 by
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 void resetCounter(); 00020 float getSpeedLeft(); 00021 float getSpeedRight(); 00022 float getIntegralLeft(); 00023 float getIntegralRight(); 00024 float getProportionalLeft(); 00025 float getProportionalRight(); 00026 00027 private: 00028 00029 static const float PERIOD; 00030 static const float COUNTS_PER_TURN; 00031 static const float LOWPASS_FILTER_FREQUENCY; 00032 static const float KN; 00033 static const float KP; 00034 static const float KI; 00035 static const float I_MAX; 00036 static const float MAX_VOLTAGE; 00037 static const float MIN_DUTY_CYCLE; 00038 static const float MAX_DUTY_CYCLE; 00039 00040 PwmOut& pwmLeft; 00041 PwmOut& pwmRight; 00042 EncoderCounter& counterLeft; 00043 EncoderCounter& counterRight; 00044 short previousValueCounterLeft; 00045 short previousValueCounterRight; 00046 LowpassFilter speedLeftFilter; 00047 LowpassFilter speedRightFilter; 00048 float desiredSpeedLeft; 00049 float desiredSpeedRight; 00050 float actualSpeedLeft; 00051 float actualSpeedRight; 00052 float iSumLeft; 00053 float iSumRight; 00054 Ticker ticker; 00055 00056 void run(); 00057 00058 }; 00059 00060 #endif /* CONTROLLER_H_ */ 00061 00062 00063 00064 00065
Generated on Sun Jul 17 2022 11:46:13 by
