test
Dependencies: mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM
Walk/orbit/orbit.cpp@39:87dcdff27797, 2019-03-04 (annotated)
- Committer:
- shimizuta
- Date:
- Mon Mar 04 23:41:48 2019 +0000
- Revision:
- 39:87dcdff27797
- Parent:
- 35:b4e1b8f25cd7
made FourPoint at OVERCOME;
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 | 39:87dcdff27797 | 15 | case FOURPOINT: |
shimizuta | 39:87dcdff27797 | 16 | time_s = FourPoint::GetOneWalkTime(); |
shimizuta | 39:87dcdff27797 | 17 | break; |
shimizuta | 35:b4e1b8f25cd7 | 18 | default: |
shimizuta | 35:b4e1b8f25cd7 | 19 | time_s = Triangle::GetOneWalkTime(); |
shimizuta | 35:b4e1b8f25cd7 | 20 | break; |
shimizuta | 35:b4e1b8f25cd7 | 21 | } |
shimizuta | 35:b4e1b8f25cd7 | 22 | return time_s; |
shimizuta | 35:b4e1b8f25cd7 | 23 | } |
shimizuta | 35:b4e1b8f25cd7 | 24 | int Orbit::GetOrbit(OneLeg &leg, float phasetime_s) |
shimizuta | 35:b4e1b8f25cd7 | 25 | { |
shimizuta | 35:b4e1b8f25cd7 | 26 | int ret; |
shimizuta | 35:b4e1b8f25cd7 | 27 | switch (pattern_) |
shimizuta | 35:b4e1b8f25cd7 | 28 | { |
shimizuta | 35:b4e1b8f25cd7 | 29 | case FREELINES: |
shimizuta | 35:b4e1b8f25cd7 | 30 | ret = FreeLines::GetOrbit(leg, phasetime_s); |
shimizuta | 35:b4e1b8f25cd7 | 31 | break; |
shimizuta | 39:87dcdff27797 | 32 | case FOURPOINT: |
shimizuta | 39:87dcdff27797 | 33 | ret = FourPoint::GetOrbit(leg, phasetime_s); |
shimizuta | 39:87dcdff27797 | 34 | break; |
shimizuta | 35:b4e1b8f25cd7 | 35 | default: |
shimizuta | 35:b4e1b8f25cd7 | 36 | ret = Triangle::GetOrbit(leg, phasetime_s); |
shimizuta | 35:b4e1b8f25cd7 | 37 | break; |
shimizuta | 35:b4e1b8f25cd7 | 38 | } |
shimizuta | 35:b4e1b8f25cd7 | 39 | return ret; |
shimizuta | 35:b4e1b8f25cd7 | 40 | } |
shimizuta | 39:87dcdff27797 | 41 | void Orbit::Copy(const Orbit &origin) |
shimizuta | 39:87dcdff27797 | 42 | { |
shimizuta | 35:b4e1b8f25cd7 | 43 | pattern_ = origin.pattern_; |
shimizuta | 35:b4e1b8f25cd7 | 44 | switch (pattern_) |
shimizuta | 35:b4e1b8f25cd7 | 45 | { |
shimizuta | 35:b4e1b8f25cd7 | 46 | case FREELINES: |
shimizuta | 35:b4e1b8f25cd7 | 47 | FreeLines::Copy((FreeLines)origin); |
shimizuta | 35:b4e1b8f25cd7 | 48 | break; |
shimizuta | 39:87dcdff27797 | 49 | case FOURPOINT: |
shimizuta | 39:87dcdff27797 | 50 | FourPoint::Copy((FourPoint)origin); |
shimizuta | 39:87dcdff27797 | 51 | break; |
shimizuta | 35:b4e1b8f25cd7 | 52 | default: |
shimizuta | 35:b4e1b8f25cd7 | 53 | Triangle::Copy((Triangle)origin); |
shimizuta | 35:b4e1b8f25cd7 | 54 | break; |
shimizuta | 35:b4e1b8f25cd7 | 55 | } |
shimizuta | 35:b4e1b8f25cd7 | 56 | } |