Skip to content

Commit

Permalink
Обновить levelings.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
THEb0nny committed May 19, 2024
1 parent b6ff6f2 commit ba9e2f6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions levelings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,12 @@ namespace levelings {
}

/**
* Alignment on the line in motion. Experimental.
* Выравнивание на линии в движении. Экспериментальная.
* Alignment on the line in motion.
* Do not use if the angle to the line is large.
* Alignment is also maintained when moving backwards.
* Выравнивание на линии в движении.
* Не использовать, если угол к линии будет большой.
* Поддерживается и выравнивание при движении назад.
* @param speed скорость движения, eg: 30
* @param actionAfterMotion действие после, eg: AfterMotionShort.BreakStop
* @param debug отладка, eg: false
Expand Down Expand Up @@ -286,8 +290,10 @@ namespace levelings {
control.pauseUntilTime(currTime, lineAlignmentOrPositioningLoopDt); // Ждём N мс выполнения итерации цикла
}
music.playToneInBackground(Note.E, 100); // Сигнал для понимация, что вышли из второго цикла
chassis.stop(true); // Жёсткое торможение для теста
pause(1000);
if (debug) {
chassis.stop(true); // Жёсткое торможение для теста
pause(1000);
}
a = (a / 360) * Math.PI * chassis.getWheelRadius(); // Перевести в мм пройденное значение
c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); // Рассчитываем гипотенузу
const alpha = Math.sin(a / c) * (180.0 / Math.PI); // Рассчитываем угол альфа в радианах и переводим в градусы
Expand Down

0 comments on commit ba9e2f6

Please sign in to comment.