tunin BrakeProcessor

This commit is contained in:
Stephan Richter
2021-03-12 17:19:42 +01:00
parent 629b30c078
commit 8a9aada83e
4 changed files with 10 additions and 6 deletions

View File

@@ -43,10 +43,13 @@ public class BrakeProcessor extends BaseClass implements Runnable {
int step = brakeTime;
for (int i = 0; i < 15; i++) {
long calculatedDistance = calculate(brakeTime, startSpeed);
step /= 2;
if (step < 1) step = 1;
if (measuredDistance > calculatedDistance) brakeTime += step;
if (measuredDistance > calculatedDistance) {
brakeTime += brakeTime;
step = brakeTime/3;
}
if (measuredDistance < calculatedDistance) {
step /= 2;
if (step < 1) step = 1;
brakeTime -= step;
}
LOG.debug("new brake time: {}, calculated distance: {}", brakeTime, calculatedDistance);