test
Dependencies: mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM
Walk/orbit/orbit.cpp@35:b4e1b8f25cd7, 2019-03-04 (annotated)
- Committer:
- shimizuta
- Date:
- Mon Mar 04 09:54:47 2019 +0000
- Revision:
- 35:b4e1b8f25cd7
- Child:
- 39:87dcdff27797
new MR2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimizuta | 35:b4e1b8f25cd7 | 1 | #include "orbit.h" |
shimizuta | 35:b4e1b8f25cd7 | 2 | |
shimizuta | 35:b4e1b8f25cd7 | 3 | Orbit::Orbit(OrbitPattern pattern) |
shimizuta | 35:b4e1b8f25cd7 | 4 | { |
shimizuta | 35:b4e1b8f25cd7 | 5 | pattern_ = pattern; |
shimizuta | 35:b4e1b8f25cd7 | 6 | } |
shimizuta | 35:b4e1b8f25cd7 | 7 | float Orbit::GetOneWalkTime() |
shimizuta | 35:b4e1b8f25cd7 | 8 | { |
shimizuta | 35:b4e1b8f25cd7 | 9 | float time_s; |
shimizuta | 35:b4e1b8f25cd7 | 10 | switch (pattern_) |
shimizuta | 35:b4e1b8f25cd7 | 11 | { |
shimizuta | 35:b4e1b8f25cd7 | 12 | case FREELINES: |
shimizuta | 35:b4e1b8f25cd7 | 13 | time_s = FreeLines::GetOneWalkTime(); |
shimizuta | 35:b4e1b8f25cd7 | 14 | break; |
shimizuta | 35:b4e1b8f25cd7 | 15 | default: |
shimizuta | 35:b4e1b8f25cd7 | 16 | time_s = Triangle::GetOneWalkTime(); |
shimizuta | 35:b4e1b8f25cd7 | 17 | break; |
shimizuta | 35:b4e1b8f25cd7 | 18 | } |
shimizuta | 35:b4e1b8f25cd7 | 19 | return time_s; |
shimizuta | 35:b4e1b8f25cd7 | 20 | } |
shimizuta | 35:b4e1b8f25cd7 | 21 | int Orbit::GetOrbit(OneLeg &leg, float phasetime_s) |
shimizuta | 35:b4e1b8f25cd7 | 22 | { |
shimizuta | 35:b4e1b8f25cd7 | 23 | int ret; |
shimizuta | 35:b4e1b8f25cd7 | 24 | switch (pattern_) |
shimizuta | 35:b4e1b8f25cd7 | 25 | { |
shimizuta | 35:b4e1b8f25cd7 | 26 | case FREELINES: |
shimizuta | 35:b4e1b8f25cd7 | 27 | ret = FreeLines::GetOrbit(leg, phasetime_s); |
shimizuta | 35:b4e1b8f25cd7 | 28 | break; |
shimizuta | 35:b4e1b8f25cd7 | 29 | default: |
shimizuta | 35:b4e1b8f25cd7 | 30 | ret = Triangle::GetOrbit(leg, phasetime_s); |
shimizuta | 35:b4e1b8f25cd7 | 31 | break; |
shimizuta | 35:b4e1b8f25cd7 | 32 | } |
shimizuta | 35:b4e1b8f25cd7 | 33 | return ret; |
shimizuta | 35:b4e1b8f25cd7 | 34 | } |
shimizuta | 35:b4e1b8f25cd7 | 35 | void Orbit::Copy(const Orbit &origin){ |
shimizuta | 35:b4e1b8f25cd7 | 36 | pattern_ = origin.pattern_; |
shimizuta | 35:b4e1b8f25cd7 | 37 | switch (pattern_) |
shimizuta | 35:b4e1b8f25cd7 | 38 | { |
shimizuta | 35:b4e1b8f25cd7 | 39 | case FREELINES: |
shimizuta | 35:b4e1b8f25cd7 | 40 | FreeLines::Copy((FreeLines)origin); |
shimizuta | 35:b4e1b8f25cd7 | 41 | break; |
shimizuta | 35:b4e1b8f25cd7 | 42 | default: |
shimizuta | 35:b4e1b8f25cd7 | 43 | Triangle::Copy((Triangle)origin); |
shimizuta | 35:b4e1b8f25cd7 | 44 | break; |
shimizuta | 35:b4e1b8f25cd7 | 45 | } |
shimizuta | 35:b4e1b8f25cd7 | 46 | } |