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

ActionBuf.cpp

Committer:
henryrawas
Date:
2016-01-15
Revision:
13:ffeff9b5e513
Parent:
10:9b21566a5ddb

File content as of revision 13:ffeff9b5e513:

#include "mbed.h"
#include "rtos.h"

#include "ActionBuf.h"


bool ActionGroup::SetAction(ArmAction aId, char* args)
{
    if (strlen(args) < ActionArgSize)
    {
        ActionId = aId;

        strcpy(ActionArg, args); 
        
        return true;
    }
    return false;
}


ActionSequence::ActionSequence()
{
};

ActionSequence::ActionSequence(SequenceAction aType)
{
    ActionType = aType;
    Param = 0;
    NumParts = 0;
};

ActionSequence::ActionSequence(SequenceAction aType, int parts, const float vals[], int param)
{
    ActionType = aType;

    if (parts > NUMJOINTS) parts = NUMJOINTS;
    
    if (vals != NULL)
    {
        for (int i = 0; i < parts; i++)
            GoalVals[i] = vals[i];
    }
    NumParts = parts;
    
    Param = param;
}

void ActionSequence::SetGoal(int parts, const float 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)
{
    Param = param;
}
    
void ActionSequence::SetAction(SequenceAction aType)
{
    ActionType = aType;
}