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@18:224289104fc0, 2016-01-23 (annotated)
- Committer:
- henryrawas
- Date:
- Sat Jan 23 00:08:30 2016 +0000
- Revision:
- 18:224289104fc0
- Child:
- 19:2f0ec9ac1238
refactor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryrawas | 18:224289104fc0 | 1 | #include "mbed.h" |
henryrawas | 18:224289104fc0 | 2 | #include "rtos.h" |
henryrawas | 18:224289104fc0 | 3 | |
henryrawas | 18:224289104fc0 | 4 | #include "ActionBuf.h" |
henryrawas | 18:224289104fc0 | 5 | |
henryrawas | 18:224289104fc0 | 6 | |
henryrawas | 18:224289104fc0 | 7 | ActionSequence::ActionSequence() |
henryrawas | 18:224289104fc0 | 8 | { |
henryrawas | 18:224289104fc0 | 9 | }; |
henryrawas | 18:224289104fc0 | 10 | |
henryrawas | 18:224289104fc0 | 11 | ActionSequence::ActionSequence(SequenceAction aType) |
henryrawas | 18:224289104fc0 | 12 | { |
henryrawas | 18:224289104fc0 | 13 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 14 | Param = 0; |
henryrawas | 18:224289104fc0 | 15 | NumParts = 0; |
henryrawas | 18:224289104fc0 | 16 | }; |
henryrawas | 18:224289104fc0 | 17 | |
henryrawas | 18:224289104fc0 | 18 | ActionSequence::ActionSequence(SequenceAction aType, int parts, const float vals[], int param) |
henryrawas | 18:224289104fc0 | 19 | { |
henryrawas | 18:224289104fc0 | 20 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 21 | |
henryrawas | 18:224289104fc0 | 22 | if (parts > NUMJOINTS) parts = NUMJOINTS; |
henryrawas | 18:224289104fc0 | 23 | |
henryrawas | 18:224289104fc0 | 24 | if (vals != NULL) |
henryrawas | 18:224289104fc0 | 25 | { |
henryrawas | 18:224289104fc0 | 26 | for (int i = 0; i < parts; i++) |
henryrawas | 18:224289104fc0 | 27 | GoalVals[i] = vals[i]; |
henryrawas | 18:224289104fc0 | 28 | } |
henryrawas | 18:224289104fc0 | 29 | NumParts = parts; |
henryrawas | 18:224289104fc0 | 30 | |
henryrawas | 18:224289104fc0 | 31 | Param = param; |
henryrawas | 18:224289104fc0 | 32 | } |
henryrawas | 18:224289104fc0 | 33 | |
henryrawas | 18:224289104fc0 | 34 | void ActionSequence::SetGoal(int parts, const float vals[]) |
henryrawas | 18:224289104fc0 | 35 | { |
henryrawas | 18:224289104fc0 | 36 | if (parts > NUMJOINTS) parts = NUMJOINTS; |
henryrawas | 18:224289104fc0 | 37 | |
henryrawas | 18:224289104fc0 | 38 | if (vals != NULL) |
henryrawas | 18:224289104fc0 | 39 | { |
henryrawas | 18:224289104fc0 | 40 | for (int i = 0; i < parts; i++) |
henryrawas | 18:224289104fc0 | 41 | GoalVals[i] = vals[i]; |
henryrawas | 18:224289104fc0 | 42 | } |
henryrawas | 18:224289104fc0 | 43 | NumParts = parts; |
henryrawas | 18:224289104fc0 | 44 | } |
henryrawas | 18:224289104fc0 | 45 | |
henryrawas | 18:224289104fc0 | 46 | void ActionSequence::SetParam(int param) |
henryrawas | 18:224289104fc0 | 47 | { |
henryrawas | 18:224289104fc0 | 48 | Param = param; |
henryrawas | 18:224289104fc0 | 49 | } |
henryrawas | 18:224289104fc0 | 50 | |
henryrawas | 18:224289104fc0 | 51 | void ActionSequence::SetAction(SequenceAction aType) |
henryrawas | 18:224289104fc0 | 52 | { |
henryrawas | 18:224289104fc0 | 53 | ActionType = aType; |
henryrawas | 18:224289104fc0 | 54 | } |
henryrawas | 18:224289104fc0 | 55 | |
henryrawas | 18:224289104fc0 | 56 |