test
Dependencies: mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM
Diff: Walk/orbit/freeline/freeline.cpp
- Revision:
- 42:982064594ba6
- Parent:
- 41:38d79b6513c0
- Child:
- 43:2ed84f3558c1
--- a/Walk/orbit/freeline/freeline.cpp Tue Mar 05 01:45:03 2019 +0000 +++ b/Walk/orbit/freeline/freeline.cpp Tue Mar 05 09:08:40 2019 +0000 @@ -7,7 +7,6 @@ } int FreeLines::GetOrbit(OneLeg &leg, float phasetime_s) { - ; //現在の最終到達pointを決定 int next_point; for (next_point = 0; next_point < point_num_ - 1; next_point++) // point_num - 1が配列の最大index.これを超えないようにしている @@ -15,25 +14,23 @@ if (phasetime_s < lineparams_[next_point].time_s) break; } - //x,yを計算 float x_m, y_m; - float d_phase = phasetime_s - lineparams_[next_point - 1].time_s; - float d_time = lineparams_[next_point].time_s - lineparams_[next_point - 1].time_s; - float phase_rate = d_phase / d_time; - - if(lineparams_[next_point - 1].line_state == 1) + if (lineparams_[next_point - 1].is_point_to_point == 1) { x_m = lineparams_[next_point].x_m; y_m = lineparams_[next_point].y_m; } else { + //x,yを計算 + float d_phase = phasetime_s - lineparams_[next_point - 1].time_s; + float d_time = lineparams_[next_point].time_s - lineparams_[next_point - 1].time_s; + float phase_rate = d_phase / d_time; x_m = lineparams_[next_point - 1].x_m + (lineparams_[next_point].x_m - lineparams_[next_point - 1].x_m) * phase_rate; y_m = lineparams_[next_point - 1].y_m + (lineparams_[next_point].y_m - lineparams_[next_point - 1].y_m) * phase_rate; } - return leg.SetXY_m(x_m, y_m); } float FreeLines::GetOneWalkTime() //足一周の時間 @@ -42,7 +39,7 @@ } void FreeLines::Copy(const FreeLines &origin) { - point_num_ = origin.point_num_; //pointの数 + point_num_ = origin.point_num_; //pointの数 for (int i = 0; i < point_num_; i++) lineparams_[i] = origin.lineparams_[i]; } \ No newline at end of file