Jorn Dokter / Mbed 2 deprecated TEB_branch2

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
37:6602655a80f4
Parent:
36:331907080ffb
Child:
39:8d8ff9a30cfc
diff -r 331907080ffb -r 6602655a80f4 motorAndSensorControl.cpp
--- a/motorAndSensorControl.cpp	Thu Oct 10 14:47:47 2019 +0000
+++ b/motorAndSensorControl.cpp	Thu Oct 10 15:33:24 2019 +0000
@@ -35,10 +35,14 @@
         const double PI = 3.14159265358979;
         const float countsToRadians = (2*PI)/uniqueMeasurementPoints; //Number of radians per count
         
-        motorData motorReturn;
+        //motorData motorReturn;
 
-void motorAndEncoder(float PWM1, float PWM2, float PWM3, float dt)
+void motorAndEncoder()
 {
+    float PWM1 = motorData.motor1.input.PWM;
+    float PWM2 = motorData.motor2.input.PWM;
+    float PWM3 = motorData.motor3.input.PWM;
+    float dt = motorData.dt;
     //Set motors
         //Direction
             //Motor 1
@@ -103,16 +107,16 @@
             //velocityMotor3 = ((countsMotor3[1]-countsMotor3[0])/countsToRadians)/dt; //rad/s
     
     //Push variables to global structure
-        ::motorReturn.motor1.counts = countsMotor1[1]; //:: To signal the global structure
-        ::motorReturn.motor2.counts = countsMotor2[1];
+        ::motorData.motor1.output.counts = countsMotor1[1]; //:: To signal the global structure
+        ::motorData.motor2.output.counts = countsMotor2[1];
         //::motorReturn.motor3.counts = countsMotor3[1];
         
-        ::motorReturn.motor1.angle = angleMotor1;
-        ::motorReturn.motor2.angle = angleMotor2;
+        ::motorData.motor1.output.angle = angleMotor1;
+        ::motorData.motor2.output.angle = angleMotor2;
         //::motorReturn.motor3.angle = angleMotor3;
         
-        ::motorReturn.motor1.velocity = velocityMotor1;
-        ::motorReturn.motor2.velocity = velocityMotor2;
+        ::motorData.motor1.output.velocity = velocityMotor1;
+        ::motorData.motor2.output.velocity = velocityMotor2;
         //::motorReturn.motor3.velocity = velocityMotor3;
     
 }