Getting Synched

First time after a lot of tries. -Bill
This commit is contained in:
Bill Verplank
2012-12-07 08:15:45 -08:00
parent 0a0e857cea
commit 4c9e2ee748
23 changed files with 1849 additions and 439 deletions
@@ -0,0 +1,20 @@
//Damp3 trying integration to get velocity
// ala Kalman filtering?
int x; //position measured [0-1023]
float af, vf //acceleration, velocity estimates
float ff // force out
float K = 1.0 //spring
float B = 10.0 //damping (dominant)
float M = 1.0 //mass
void setup(){
Serial.begin(115200);
}
void loop(){
x = analogRead(A0);
ff = K*(xf-x) - B*vf; // the spring K
af = ff/M;
vf += af*T; //T is cycle time
xf += vf*T;