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: mbed-rtos mbed MODSERIAL mbed-dsp telemetry
Revision 7:62ebacf26446, committed 2015-03-19
- Comitter:
- ericoneill
- Date:
- Thu Mar 19 05:21:34 2015 +0000
- Parent:
- 5:764c2ffb523a
- Child:
- 8:8036a056f499
- Commit message:
- MORE ENCODER STUFF
Changed in this revision
| encoder.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/encoder.h Thu Mar 19 05:18:52 2015 +0000
+++ b/encoder.h Thu Mar 19 05:21:34 2015 +0000
@@ -8,6 +8,17 @@
void fallInterrupt();
void riseInterrupt();
private:
+ //Observed average speeds for each duty cycle
+ const float TUNING_CONSTANT_20 = 3.00;
+ const float TUNING_CONSTANT_30 = 4.30;
+ const float TUNING_CONSTANT_50 = 6.880;
+ const float PI = 3.14159;
+ const float WHEEL_CIRCUMFERENCE = .05*PI;
+
+ //Velocity Control Tuning Constants
+ const float TUNE_THRESH = 0.5f;
+ const float TUNE_AMT = 0.1f;
+
//Intervals used during encoder data collection to measure velocity
int interval1=0;
int interval2=0;
@@ -23,6 +34,19 @@
float stall_check = 0;
float tuning_val = 1;
+ // Servo parameters
+ float lastTurnTime = 0.0f;
+ bool servoLeft = true;
+
+ //Parameters specifying sample sizes and delays for small and large average speed samples
+ float num_samples_small = 10.0f;
+ float delay_small = 0.05f;
+ float num_samples_large = 100.0f;
+ float delay_large = 0.1f;
+
+ // Large and small arrays used to get average velocity values
+ float large_avg_speed_list [100];
+ float small_avg_speed_list [10];
float get_speed();
float get_avg_speed(float num_samples, float delay);