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.
Dependencies: LSM9DS1 RangeFinder FastPWM
Dependents: PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more
Diff: SpeedController.h
- Revision:
- 4:9c003c402033
- Parent:
- 3:8b42e643b294
- Child:
- 5:6cd242a61e4c
diff -r 8b42e643b294 -r 9c003c402033 SpeedController.h
--- a/SpeedController.h Thu Apr 01 14:31:43 2021 +0000
+++ b/SpeedController.h Tue Apr 06 11:21:54 2021 +0000
@@ -8,34 +8,40 @@
class SpeedController
{
-
public:
- SpeedController(PwmOut& pwm, EncoderCounter& encoderCounter);
+ SpeedController(float COUNTS_PER_TURN, float KN, float KP, float MAX_VOLTAGE, PwmOut& pwm, EncoderCounter& encoderCounter);
virtual ~SpeedController();
- void setDesiredSpeed(float desiredSpeed);
- float getSpeed();
+ void setDesiredSpeedRPM(float desiredSpeed);
+ float getSpeedRPM();
+ void setDesiredSpeedRPS(float desiredSpeed);
+ float getSpeedRPS();
private:
static const float PERIOD;
- static const float COUNTS_PER_TURN;
+ // static const float COUNTS_PER_TURN;
static const float LOWPASS_FILTER_FREQUENCY;
- static const float KN;
- static const float KP;
- static const float MAX_VOLTAGE;
+ // 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;
+ float COUNTS_PER_TURN;
+ float KN;
+ float KP;
+ float MAX_VOLTAGE;
+
PwmOut& pwm;
EncoderCounter& encoderCounter;
short previousValueCounter;
LowpassFilter speedFilter;
float desiredSpeed;
float actualSpeed;
- float actualAngle;
+ // float actualAngle;
ThreadFlag threadFlag;
Thread thread;
@@ -43,7 +49,6 @@
void sendThreadFlag();
void run();
-
};
#endif /* SpeedController_H_ */
\ No newline at end of file
