From cd937c5e507fc78d2e66c68108d8fd31afa6a1f8 Mon Sep 17 00:00:00 2001 From: Ulysse Cura Date: Sat, 1 Feb 2025 13:51:15 +0100 Subject: [PATCH] Normalisation des vitesses. --- Main.ino | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Main.ino b/Main.ino index 3f5e5f8..fb80311 100644 --- a/Main.ino +++ b/Main.ino @@ -5,6 +5,10 @@ #include "IO.hpp" +#define NORMAL_SPEED 2048.0f +#define TURNING_SPEED 1500.0f +#define ON_STAGE_SPEED 1120.0f + // Unit tests activation //#define UNIT_TESTS @@ -108,8 +112,8 @@ void loop() case State::WaitingTimer: static unsigned long initial_time = millis(); - if(millis() - initial_time >= 90000) - //if(millis() - initial_time >= 2000) + //if(millis() - initial_time >= 90000) + if(millis() - initial_time >= 2000) { my_IO.initGyroscope(); actual_state = State::ForwardToRamp; @@ -118,7 +122,7 @@ void loop() case State::ForwardToRamp: my_IO.motorControlOn(); - my_IO.setSpeed(2048.0f); + my_IO.setSpeed(NORMAL_SPEED); if(my_IO.getAngle(Axes::Y) < -5.0f) { @@ -127,10 +131,9 @@ void loop() break; case State::ForwardToScene: - my_IO.setSpeed(2048.0f); - if(my_IO.getAngle(Axes::Y) > -5.0f) { + my_IO.setSpeed(ON_STAGE_SPEED); actual_state = my_IO.isSelectedColorBlue() ? State::Turn90Blue : State::Turn90Yellow; //actual_state = State::Dancing; } @@ -155,7 +158,7 @@ void loop() break; case State::ForwardToSceneEdge: - my_IO.setSpeed(1200.0f); + my_IO.setSpeed(ON_STAGE_SPEED); if(my_IO.getAngle(Axes::Y) > 5.0f) {