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.
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 #include "ThreadFlag.h" 00008 00009 class Controller 00010 { 00011 00012 public: 00013 00014 Controller(PwmOut& pwmLeft, PwmOut& pwmRight, 00015 EncoderCounter& counterLeft, EncoderCounter& counterRight); 00016 00017 virtual ~Controller(); 00018 void setDesiredSpeedLeft(float desiredSpeedLeft); 00019 void setDesiredSpeedRight(float desiredSpeedRight); 00020 float getSpeedLeft(); 00021 float getSpeedRight(); 00022 00023 private: 00024 00025 static const uint32_t STACK_SIZE = 4096; // stack size of thread, given in [bytes] 00026 static const float PERIOD; 00027 static const float COUNTS_PER_TURN; 00028 static const float LOWPASS_FILTER_FREQUENCY; 00029 static const float KN; 00030 static const float KP; 00031 static const float MAX_VOLTAGE; 00032 static const float MIN_DUTY_CYCLE; 00033 static const float MAX_DUTY_CYCLE; 00034 00035 PwmOut& pwmLeft; 00036 PwmOut& pwmRight; 00037 EncoderCounter& counterLeft; 00038 EncoderCounter& counterRight; 00039 short previousValueCounterLeft; 00040 short previousValueCounterRight; 00041 LowpassFilter speedLeftFilter; 00042 LowpassFilter speedRightFilter; 00043 float desiredSpeedLeft; 00044 float desiredSpeedRight; 00045 float actualSpeedLeft; 00046 float actualSpeedRight; 00047 float actualAngleLeft; 00048 float actualAngleRight; 00049 00050 ThreadFlag threadFlag; 00051 Thread thread; 00052 Ticker ticker; 00053 00054 void sendThreadFlag(); 00055 void run(); 00056 00057 }; 00058 00059 #endif /* CONTROLLER_H_ */
Generated on Tue Jul 12 2022 17:56:06 by
1.7.2