test
Dependencies: mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM
Diff: Walk/Walk.cpp
- Revision:
- 19:1adc7302cfd9
- Parent:
- 18:0033ef1814ba
- Child:
- 21:61971fc18b90
diff -r 0033ef1814ba -r 1adc7302cfd9 Walk/Walk.cpp --- a/Walk/Walk.cpp Thu Feb 14 09:04:25 2019 +0000 +++ b/Walk/Walk.cpp Fri Feb 15 03:46:52 2019 +0000 @@ -8,30 +8,31 @@ orbitType_ = orbitType; } -void Orbit::SetStraightParam(float stridetime_s, float risetime_s, float stride_m, float height_m, float ground_m) +void Orbit::SetStraightParam(float stridetime_s, float risetime_s, float stride_m, float height_m, float offset_x_m, float offset_y_m) { stridetime_s_ = stridetime_s; risetime_s_ = risetime_s; stride_m_ = stride_m; height_m_ = height_m; - ground_m_ = ground_m; - offset_x_m_ = 0; + offset_x_m_ = offset_x_m; + offset_y_m_ = offset_y_m; } -void Orbit::SetStraightParam(float stridetime_s, float risetime_s, float stride_m, float height_m, float ground_m, float offset_x_m) + +void Orbit::SetStandParam(float offset_y_m) { - stridetime_s_ = stridetime_s; - risetime_s_ = risetime_s; - stride_m_ = stride_m; - height_m_ = height_m; - ground_m_ = ground_m; - offset_x_m_ = offset_x_m; + stridetime_s_ = 1; + risetime_s_ = 0; + stride_m_ = 0; + height_m_ = 0; + offset_x_m_ = 0; + offset_y_m_ = offset_y_m; } //着地中の動き.直線軌道.等速 OneLeg Orbit::StrideLine_(OneLeg leg, float phasetime_s) { - float x_m = -stride_m_ * phasetime_s / stridetime_s_ + stride_m_ * 0.5 - offset_x_m_; - float y_m = ground_m_; + float x_m = -stride_m_ * phasetime_s / stridetime_s_ + stride_m_ * 0.5 + offset_x_m_; + float y_m = offset_y_m_; leg.SetXY_m(x_m, y_m); return leg; } @@ -39,8 +40,8 @@ OneLeg Orbit::RiseEllipse_(OneLeg leg, float phasetime_s) { float rad = M_PI * (phasetime_s - stridetime_s_) / risetime_s_ + M_PI; - float x_m = stride_m_ * 0.5 * cos(rad) - offset_x_m_; - float y_m = height_m_ * sin(rad) + ground_m_; + float x_m = stride_m_ * 0.5 * cos(rad) + offset_x_m_; + float y_m = height_m_ * sin(rad) + offset_y_m_; leg.SetXY_m(x_m, y_m); return leg; }