robot

Dependencies:   FastPWM3 mbed

Revision:
165:2463dbe52eee
Parent:
154:0a22dcf91577
Child:
179:935f9d78d936
Child:
180:a783a972a867
--- a/BREMS/BREMSConfig.cpp	Sat Jul 01 22:33:29 2017 +0000
+++ b/BREMS/BREMSConfig.cpp	Mon Sep 04 07:09:16 2017 +0000
@@ -104,15 +104,18 @@
     pc->printf("\n\r");
 }
 
-void BREMSInit(IOStruct *io, ReadDataStruct *read, FOCStruct *foc, ControlStruct *control, bool tune) {
+void BREMSInit(IOStruct *io, ReadDataStruct *read, FOCStruct *foc, ControlStruct *control, bool tune) {    
     io->en = new DigitalOut(EN);
     io->en->write(0);
     
     io->pc = new Serial(USBTX, USBRX);
     io->pc->baud(921600);
-        
+    
+    io->pos = new PositionSensorEncoder(CPR, 0);
+    
+    wait_ms(750);
+            
     io->throttle_in = new PwmIn(TH_PIN, TH_LIMIT_LOW, TH_LIMIT_HIGH);
-    io->pos = new PositionSensorEncoder(CPR, 0);
     
     control->throttle_filter = new MedianFilter(THROTTLE_FILTER_WINDOW);
     control->velocity_filter = new MedianFilter(W_FILTER_WINDOW);