🌹 Switches to an explicit sense plan act flow

This commit is contained in:
Rune Harlyk
2024-11-14 10:36:44 +01:00
committed by Rune Harlyk
parent e919b2aa41
commit f3d2fec0e9
5 changed files with 62 additions and 111 deletions
+17 -6
View File
@@ -1,16 +1,27 @@
#include <ESP32SvelteKit.h>
#include <spot.h>
#include <PsychicHttpServer.h>
#define SERIAL_BAUD_RATE 115200
DRAM_ATTR PsychicHttpServer server;
DRAM_ATTR ESP32SvelteKit spot(&server);
DRAM_ATTR Spot spot(&server);
void IRAM_ATTR SpotControlLoopEntry(void*) {
TickType_t xLastWakeTime = xTaskGetTickCount();
for (;;) {
spot.readSensors();
spot.planMotion();
spot.updateActuators();
spot.emitTelemetry();
vTaskDelayUntil(&xLastWakeTime, 10 / portTICK_PERIOD_MS);
}
}
void setup() {
Serial.begin(SERIAL_BAUD_RATE);
Serial.begin(115200);
spot.begin();
spot.initialize();
g_taskManager.createTask(SpotControlLoopEntry, "Spot control task", 4096, nullptr, 3);
}
void loop() { vTaskDelete(NULL); }