Skip to content

Commit

Permalink
制動出力: 現在減速度が逆算値から離れていっているときは再計算する
Browse files Browse the repository at this point in the history
この場合はさっさとノッチ当たり減速度にフィードバックしてよい。
  • Loading branch information
magicant committed Feb 19, 2019
1 parent 69c3645 commit 1ec88f4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bve-autopilot/制動出力.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,23 @@ namespace autopilot
return;
}

// 加速度が大きく変化している間はノッチ当たり減速度を再計算しない
if (std::abs(加速状態.加加速度()) > mps_from_kmph(1)) {
return;
}

// 減速していなければノッチ当たり減速度を再計算しない
加速度型 減速度 = -加速状態.加速度();
if (減速度 <= 0) {
return;
}

// ノッチ当たり減速度を再計算する
// 加速度が大きく前回結果に近付いていっている間は再計算しない
int 実効ノッチ = 前回出力ノッチ - _無効ノッチ数;
加速度型 逆算減速度 = 実効ノッチ * _ノッチ当たり減速度;
if (加速状態.加加速度() > mps_from_kmph(1) && 減速度 > 逆算減速度) {
return;
}
if (加速状態.加加速度() < mps_from_kmph(1) && 減速度 < 逆算減速度) {
return;
}

// ノッチ当たり減速度を再計算する
_ノッチ当たり減速度 = 減速度 / 実効ノッチ;
}

Expand Down

0 comments on commit 1ec88f4

Please sign in to comment.