Code for the car to drive in a figure eight motion

Dependencies:   mbed-rtos mbed MODSERIAL mbed-dsp telemetry

Committer:
ericoneill
Date:
Thu Mar 19 05:18:52 2015 +0000
Revision:
5:764c2ffb523a
Parent:
0:2002d645d2a6
Child:
7:62ebacf26446
encoder class framework

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ericoneill 5:764c2ffb523a 1 #ifndef ENCODER_H
ericoneill 5:764c2ffb523a 2 #define ENCODER_H
ericoneill 5:764c2ffb523a 3
ericoneill 5:764c2ffb523a 4 class Statechart{
ericoneill 5:764c2ffb523a 5
ericoneill 5:764c2ffb523a 6 public:
ericoneill 5:764c2ffb523a 7 void velocity_control(float duty_cyc, float tuning_const);
ericoneill 5:764c2ffb523a 8 void fallInterrupt();
ericoneill 5:764c2ffb523a 9 void riseInterrupt();
ericoneill 5:764c2ffb523a 10 private:
ericoneill 5:764c2ffb523a 11 //Intervals used during encoder data collection to measure velocity
ericoneill 5:764c2ffb523a 12 int interval1=0;
ericoneill 5:764c2ffb523a 13 int interval2=0;
ericoneill 5:764c2ffb523a 14 int interval3=0;
ericoneill 5:764c2ffb523a 15 int avg_interval=0;
ericoneill 5:764c2ffb523a 16 int lastchange1 = 0;
ericoneill 5:764c2ffb523a 17 int lastchange2 = 0;
ericoneill 5:764c2ffb523a 18 int lastchange3 = 0;
ericoneill 5:764c2ffb523a 19 int lastchange4 = 0;
ericoneill 5:764c2ffb523a 20
ericoneill 5:764c2ffb523a 21 //Variables used to for velocity control
ericoneill 5:764c2ffb523a 22 float avg_speed = 0;
ericoneill 5:764c2ffb523a 23 float stall_check = 0;
ericoneill 5:764c2ffb523a 24 float tuning_val = 1;
ericoneill 5:764c2ffb523a 25
ericoneill 5:764c2ffb523a 26 float get_speed();
ericoneill 5:764c2ffb523a 27 float get_avg_speed(float num_samples, float delay);
ericoneill 5:764c2ffb523a 28
ericoneill 5:764c2ffb523a 29
ericoneill 5:764c2ffb523a 30
ericoneill 5:764c2ffb523a 31 }