lizard leg trajectory pd control code for 2.s994

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
lukeplummer
Date:
Sun Dec 01 21:19:53 2013 +0000
Parent:
8:448376e7d8f1
Child:
10:6ecef8d1a018
Commit message:
file writing not active, sends external trigger for recording;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Dec 01 20:10:29 2013 +0000
+++ b/main.cpp	Sun Dec 01 21:19:53 2013 +0000
@@ -29,6 +29,8 @@
 FILE *fp1 = fopen("/local/encoders.csv", "w");
 FILE *fp2 = fopen("/local/force.csv", "w");
 
+DigitalOut dOut1(p17);
+
 float a1_t0 = 0;    //motor angle 1 from previous time step
 float a1_t1 = 0;    //motor angle 1 from current time step
 float a2_t0 = 0;    //motor angle 2 from current time step
@@ -105,6 +107,7 @@
 }
 
 int main() {
+    wait(5.0);
     mDir1_A = 1;
     mDir1_B = 0;
     mDir2_A = 1;
@@ -113,12 +116,15 @@
     mySerial.printf("numPoints: %d, fTraj: %f, fPWM: %f\n\r", numPoints, fTraj, fPWM);
     
     //get initial position
-        
+    
+    dOut1.write(1);
+    wait(0.1);    
+    dOut1.write(0);
     
     if (sizeof(traj1) == sizeof(traj2)) {
         trajTicker.attach(setTraj, 1/fTraj);
         ctrlTicker.attach(pdControl, 1/fPWM);
-        writeTicker.attach(writeFiles, 0.01);
+        //writeTicker.attach(writeFiles, 0.01);
         while (!done) {
             mySerial.printf("motor 2: %f \n\r", a2_t1);
         }