demo project

Dependencies:   AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL

Revision:
17:0dbcbd8587fd
Parent:
14:570c8071f577
--- a/ControllerUtil.cpp	Tue Jan 19 20:18:23 2016 +0000
+++ b/ControllerUtil.cpp	Fri Jan 22 01:35:07 2016 +0000
@@ -129,40 +129,41 @@
 bool PushMeasurements(int partSize, RobotArm& robotArm)
 {
     // space for getting measurements from arm
-    MeasureGroup measureGroup;
+    MeasureSnapshot measureSnap;
     
     float lastVals[NUMJOINTS];
-    time_t seconds = time(NULL);
+    measureSnap.Created = time(NULL);
    
     bool ok = true;
 
     ok = robotArm.GetArmLastMeasure(NM_Temperature, lastVals);
     DispMeasure("Temperatures", partSize, lastVals);
-    measureGroup.SetMeasure(NM_Temperature, seconds, partSize, lastVals);
-    MeasureBuf.push(measureGroup);
+    measureSnap.Temps.SetMeasure(NM_Temperature, partSize, lastVals);
     
     if (ok)
     {
         ok = robotArm.GetArmLastMeasure(NM_Voltage, lastVals);
         DispMeasure("Voltage", partSize, lastVals);
-        measureGroup.SetMeasure(NM_Voltage, seconds, partSize, lastVals);
-        MeasureBuf.push(measureGroup);
+        measureSnap.Volts.SetMeasure(NM_Voltage, partSize, lastVals);
     }
     
     if (ok)
     {
         ok = robotArm.GetArmLastMeasure(NM_Degrees, lastVals);
         DispMeasure("Rotation", partSize, lastVals);
-        measureGroup.SetMeasure(NM_Degrees, seconds, partSize, lastVals);
-        MeasureBuf.push(measureGroup);
+        measureSnap.Positions.SetMeasure(NM_Degrees, partSize, lastVals);
     }
     
     if (ok)
     {
-        robotArm.GetArmLastMeasure(NM_Load, lastVals);
+        ok = robotArm.GetArmLastMeasure(NM_Load, lastVals);
         DispMeasure("Load", partSize, lastVals);
-        measureGroup.SetMeasure(NM_Load, seconds, partSize, lastVals);
-        MeasureBuf.push(measureGroup);
+        measureSnap.Loads.SetMeasure(NM_Load, partSize, lastVals);
+    }
+    
+    if (ok)
+    {
+        MeasureBuf.push(measureSnap);
     }
     
     return ok;