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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ActionBuf.cpp Source File

ActionBuf.cpp

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 
00007 #include "ActionBuf.h"
00008 
00009 
00010 ActionSequence::ActionSequence()
00011 {
00012 };
00013 
00014 ActionSequence::ActionSequence(SequenceAction aType)
00015 {
00016     ActionType = aType;
00017     Param = 0;
00018     NumParts = 0;
00019 };
00020 
00021 ActionSequence::ActionSequence(SequenceAction aType, int parts, const float vals[], int param)
00022 {
00023     ActionType = aType;
00024 
00025     if (parts > NUMJOINTS) parts = NUMJOINTS;
00026     
00027     if (vals != NULL)
00028     {
00029         for (int i = 0; i < parts; i++)
00030             GoalVals[i] = vals[i];
00031     }
00032     NumParts = parts;
00033     
00034     Param = param;
00035 }
00036 
00037 void ActionSequence::SetGoal(int parts, const float vals[])
00038 {
00039     if (parts > NUMJOINTS) parts = NUMJOINTS;
00040     
00041     if (vals != NULL)
00042     {
00043         for (int i = 0; i < parts; i++)
00044             GoalVals[i] = vals[i];
00045     }
00046     NumParts = parts;
00047 }
00048 
00049 void ActionSequence::SetParam(int param)
00050 {
00051     Param = param;
00052 }
00053     
00054 void ActionSequence::SetAction(SequenceAction aType)
00055 {
00056     ActionType = aType;
00057 }
00058 
00059