robot arm demo team / Mbed 2 deprecated RobotArmDemo Featured

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

Revision:
13:ffeff9b5e513
Parent:
10:9b21566a5ddb
--- a/ActionBuf.cpp	Thu Jan 07 17:31:23 2016 +0000
+++ b/ActionBuf.cpp	Fri Jan 15 22:02:46 2016 +0000
@@ -4,9 +4,6 @@
 #include "ActionBuf.h"
 
 
-
-SafeCircBuf<ActionGroup, ActionBufSize, uint32_t> ActionBuf;
-
 bool ActionGroup::SetAction(ArmAction aId, char* args)
 {
     if (strlen(args) < ActionArgSize)
@@ -29,27 +26,35 @@
 {
     ActionType = aType;
     Param = 0;
+    NumParts = 0;
 };
 
-ActionSequence::ActionSequence(SequenceAction aType, vector<float>& vals, int param)
+ActionSequence::ActionSequence(SequenceAction aType, int parts, const float vals[], int param)
 {
     ActionType = aType;
-    GoalVals = vals;
+
+    if (parts > NUMJOINTS) parts = NUMJOINTS;
+    
+    if (vals != NULL)
+    {
+        for (int i = 0; i < parts; i++)
+            GoalVals[i] = vals[i];
+    }
+    NumParts = parts;
+    
     Param = param;
 }
 
-ActionSequence::ActionSequence(SequenceAction aType, int parts, float vals[], int param)
+void ActionSequence::SetGoal(int parts, const float vals[])
 {
-    ActionType = aType;
-    GoalVals.clear();
-    for (int i = 0; i < parts; i++)
-        GoalVals.push_back(vals[i]);
-    Param = param;
-}
-
-void ActionSequence::SetGoal(vector<float>& vals)
-{
-    GoalVals = vals;
+    if (parts > NUMJOINTS) parts = NUMJOINTS;
+    
+    if (vals != NULL)
+    {
+        for (int i = 0; i < parts; i++)
+            GoalVals[i] = vals[i];
+    }
+    NumParts = parts;
 }
 
 void ActionSequence::SetParam(int param)