demo project
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
Utils/ActionBuf.cpp@33:8b9dcbf6d8ec, 2016-02-04 (annotated)
- Committer:
- henryrawas
- Date:
- Thu Feb 04 20:10:33 2016 +0000
- Revision:
- 33:8b9dcbf6d8ec
- Parent:
- 19:2f0ec9ac1238
update libs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryrawas | 19:2f0ec9ac1238 | 1 | // Copyright (c) Microsoft. All rights reserved. |
henryrawas | 19:2f0ec9ac1238 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
henryrawas | 19:2f0ec9ac1238 | 3 | |
henryrawas | 18:224289104fc0 | 4 | #include "mbed.h" |
henryrawas | 18:224289104fc0 | 5 | #include "rtos.h" |
henryrawas | 18:224289104fc0 | 6 | |
henryrawas | 18:224289104fc0 | 7 | #include "ActionBuf.h" |
henryrawas | 18:224289104fc0 | 8 | |
henryrawas | 18:224289104fc0 | 9 | |
henryrawas | 18:224289104fc0 | 10 | ActionSequence::ActionSequence() |
henryrawas | 18:224289104fc0 | 11 | { |
henryrawas | 18:224289104fc0 | 12 | }; |
henryrawas | 18:224289104fc0 | 13 | |
henryrawas | 18:224289104fc0 | 14 | ActionSequence::ActionSequence(SequenceAction aType) |
henryrawas | 18:224289104fc0 | 15 | { |
henryrawas | 18:224289104fc0 | 16 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 17 | Param = 0; |
henryrawas | 18:224289104fc0 | 18 | NumParts = 0; |
henryrawas | 18:224289104fc0 | 19 | }; |
henryrawas | 18:224289104fc0 | 20 | |
henryrawas | 18:224289104fc0 | 21 | ActionSequence::ActionSequence(SequenceAction aType, int parts, const float vals[], int param) |
henryrawas | 18:224289104fc0 | 22 | { |
henryrawas | 18:224289104fc0 | 23 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 24 | |
henryrawas | 18:224289104fc0 | 25 | if (parts > NUMJOINTS) parts = NUMJOINTS; |
henryrawas | 18:224289104fc0 | 26 | |
henryrawas | 18:224289104fc0 | 27 | if (vals != NULL) |
henryrawas | 18:224289104fc0 | 28 | { |
henryrawas | 18:224289104fc0 | 29 | for (int i = 0; i < parts; i++) |
henryrawas | 18:224289104fc0 | 30 | GoalVals[i] = vals[i]; |
henryrawas | 18:224289104fc0 | 31 | } |
henryrawas | 18:224289104fc0 | 32 | NumParts = parts; |
henryrawas | 18:224289104fc0 | 33 | |
henryrawas | 18:224289104fc0 | 34 | Param = param; |
henryrawas | 18:224289104fc0 | 35 | } |
henryrawas | 18:224289104fc0 | 36 | |
henryrawas | 18:224289104fc0 | 37 | void ActionSequence::SetGoal(int parts, const float vals[]) |
henryrawas | 18:224289104fc0 | 38 | { |
henryrawas | 18:224289104fc0 | 39 | if (parts > NUMJOINTS) parts = NUMJOINTS; |
henryrawas | 18:224289104fc0 | 40 | |
henryrawas | 18:224289104fc0 | 41 | if (vals != NULL) |
henryrawas | 18:224289104fc0 | 42 | { |
henryrawas | 18:224289104fc0 | 43 | for (int i = 0; i < parts; i++) |
henryrawas | 18:224289104fc0 | 44 | GoalVals[i] = vals[i]; |
henryrawas | 18:224289104fc0 | 45 | } |
henryrawas | 18:224289104fc0 | 46 | NumParts = parts; |
henryrawas | 18:224289104fc0 | 47 | } |
henryrawas | 18:224289104fc0 | 48 | |
henryrawas | 18:224289104fc0 | 49 | void ActionSequence::SetParam(int param) |
henryrawas | 18:224289104fc0 | 50 | { |
henryrawas | 18:224289104fc0 | 51 | Param = param; |
henryrawas | 18:224289104fc0 | 52 | } |
henryrawas | 18:224289104fc0 | 53 | |
henryrawas | 18:224289104fc0 | 54 | void ActionSequence::SetAction(SequenceAction aType) |
henryrawas | 18:224289104fc0 | 55 | { |
henryrawas | 18:224289104fc0 | 56 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 57 | } |
henryrawas | 18:224289104fc0 | 58 | |
henryrawas | 18:224289104fc0 | 59 |