correction trajectoire

This commit is contained in:
dd060606
2025-05-30 21:49:06 +02:00
parent 2ae21dfad2
commit 5789b3179f
2 changed files with 18 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ struct Step
#define FALL_PIN 13 #define FALL_PIN 13
#define SERVO_PIN 12 #define SERVO_PIN 12
#define EMG_PIN 2 #define EMG_PIN 5
#endif #endif

View File

@@ -5,9 +5,9 @@
#include "utils.h" #include "utils.h"
// Côté bleu = 1 et Côté jaune = 2 // Côté bleu = 1 et Côté jaune = 2
#define PAMI_SIDE 2 #define PAMI_SIDE 1
// Numéro du pami pour les différents robots car chemins différents // Numéro du pami pour les différents robots car chemins différents
#define PAMI_NUM 2 #define PAMI_NUM 4
#define START_DELAY 5000 #define START_DELAY 5000
uint32_t startTime = 0; uint32_t startTime = 0;
@@ -34,10 +34,11 @@ Step scenario[] = {
Step scenario[] = { Step scenario[] = {
{STEP_FORWARD, 35, 2500}, {STEP_FORWARD, 35, 2500},
{STEP_ROTATE, PAMI_SIDE == 1 ? -45 + 10 * (PAMI_NUM - 2) : 45 - 10 * (PAMI_NUM - 2), 500}, {STEP_ROTATE, PAMI_SIDE == 1 ? -45 + 10 * (PAMI_NUM - 2) : 45 - 10 * (PAMI_NUM - 2), 500},
{STEP_FORWARD, 140 - 15 * PAMI_NUM, 3000}, {STEP_FORWARD, 80 - 10 * PAMI_NUM, 3000},
{STEP_ROTATE, PAMI_SIDE == 1 ? 45 - 10 * (PAMI_NUM - 2) : -45 + 10 * (PAMI_NUM - 2), 500}, {STEP_ROTATE, PAMI_SIDE == 1 ? 45 - 10 * (PAMI_NUM - 2) : -45 + 10 * (PAMI_NUM - 2), 500},
{STEP_FORWARD, 60 - 10 * PAMI_NUM, 3000},
{STEP_ROTATE, PAMI_SIDE == 1 ? -90 : 90, 500}, {STEP_ROTATE, PAMI_SIDE == 1 ? -90 : 90, 500},
{STEP_BACKWARD, 100 - 15 * PAMI_NUM, 1000}}; {STEP_BACKWARD, 50 - 10 * PAMI_NUM, 1000}};
#endif #endif
const int scenarioLength = sizeof(scenario) / sizeof(Step); const int scenarioLength = sizeof(scenario) / sizeof(Step);
@@ -379,8 +380,12 @@ void loop()
Serial.println("Scénario terminé, arrêt des moteurs."); Serial.println("Scénario terminé, arrêt des moteurs.");
stopMotors(); stopMotors();
uint32_t duty; uint32_t duty;
while(true) {
if(digitalRead(EMG_PIN)){ while (true)
{
if (!digitalRead(EMG_PIN))
{
duty = (uint32_t)((pow(2, 16) - 1) * 0.05); duty = (uint32_t)((pow(2, 16) - 1) * 0.05);
ledcWrite(0, duty); ledcWrite(0, duty);
delay(500); delay(500);
@@ -388,10 +393,12 @@ void loop()
ledcWrite(0, duty); ledcWrite(0, duty);
delay(500); delay(500);
} }
} else
// On redémarre le robot pour recommencer la partie {
ESP.restart(); ESP.restart();
break; break;
}
}
}; };
} }
} }