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 Versuch21 by
Diff: Classes/Controller.h
- Revision:
- 0:b886f13e4ac6
- Child:
- 5:93d3efe46493
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Classes/Controller.h Sun Apr 22 16:14:54 2018 +0000
@@ -0,0 +1,58 @@
+#ifndef CONTROLLER_H_
+#define CONTROLLER_H_
+#include <cstdlib>
+#include <mbed.h>
+#include "EncoderCounter.h"
+#include "LowpassFilter.h"
+
+class Controller
+{
+
+public:
+
+ Controller(PwmOut& pwmLeft, PwmOut& pwmRight,
+ EncoderCounter& counterLeft, EncoderCounter& counterRight);
+
+ virtual ~Controller();
+ void setDesiredSpeedLeft(float desiredSpeedLeft);
+ void setDesiredSpeedRight(float desiredSpeedRight);
+ static const float COUNTS_PER_TURN;
+ void resetCounter();
+
+private:
+
+ static const float PERIOD;
+
+ static const float LOWPASS_FILTER_FREQUENCY;
+ static const float KN;
+ static const float KP;
+ static const float MAX_VOLTAGE;
+ static const float MIN_DUTY_CYCLE;
+ static const float MAX_DUTY_CYCLE;
+
+ PwmOut& pwmLeft;
+ PwmOut& pwmRight;
+ EncoderCounter& counterLeft;
+ EncoderCounter& counterRight;
+ short previousValueCounterLeft;
+ short previousValueCounterRight;
+ LowpassFilter speedLeftFilter;
+ LowpassFilter speedRightFilter;
+ float desiredSpeedLeft;
+ float desiredSpeedRight;
+ float actualSpeedLeft;
+ float actualSpeedRight;
+ Ticker ticker;
+
+ void run();
+
+};
+
+#endif /* CONTROLLER_H_ */
+
+
+
+
+
+
+
