Code for the car to drive in a figure eight motion
Dependencies: mbed-rtos mbed MODSERIAL mbed-dsp telemetry
encoder.cpp
- Committer:
- ericoneill
- Date:
- 2015-03-20
- Revision:
- 9:d3909d9325e4
- Parent:
- 5:764c2ffb523a
- Child:
- 11:f8aa39c19477
File content as of revision 9:d3909d9325e4:
#include <encoder.h> //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; float Encoder::get_speed(){ float revPerSec = (1.0f/((float)avg_interval*.000001))*.25f; float linearSpeed = revPerSec * WHEEL_CIRCUMFERENCE; return linearSpeed; }