Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
Diff: ActionBuf.cpp
- 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)