Skip to content

Added support WebSocket for control via a WEB-APP#34

Open
Mateeeoy wants to merge 1 commit into
mainfrom
origin/Feature/FC/WebSocket
Open

Added support WebSocket for control via a WEB-APP#34
Mateeeoy wants to merge 1 commit into
mainfrom
origin/Feature/FC/WebSocket

Conversation

@Mateeeoy
Copy link
Copy Markdown
Collaborator

No description provided.

@github-project-automation github-project-automation Bot moved this to Backlog in WST Mar 30, 2026
Copy link
Copy Markdown
Owner

@DAXPL DAXPL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we need to test it on the drone before merging to main

sharedData->throttle = 0;
sharedData->yaw = 0;
sharedData->pitch = 0;
sharedData->roll = 0;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nie możemy w locie nagle wyłączyć silników. Do tego mamy metodę z odpowiednią procedurą. Póki co jest ona pusta, ale planowo będzie odpowiadała za powolne wyłączanie silników tak aby nie zagrażały nikomu

instance->sharedData->throttle = 0;
instance->sharedData->yaw = 0;
instance->sharedData->pitch = 0;
instance->sharedData->roll = 0;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rozłączenie nie może powodować nagłego wyłączenia silników. Raz że mamy od tego specjalną funkcję a dwa rozłączenie może być chwilowe

#include "communicationModules/CommunicationWebSocket.h"
CommunicationWebSocket* CommunicationWebSocket::instance = nullptr;
CommunicationWebSocket::CommunicationWebSocket(DroneControlData *dataPtr, DroneStatus *status)
: server(80), ws("/ws")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Przenieś protokół do pliku z konfiguracją. Obecnie będziemy mieli konflikt portów niestety

ws.onEvent(onWsEvent);
server.addHandler(&ws);
server.begin();
Serial.println("WebSocket server started on port 80");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Konkatenuj zmieenną z numerem portu - użytkownik może chcieć zmienić

ws.textAll((char*)data, sizeof(SensorsData));
}
void CommunicationWebSocket::checkConnectionTimeout() {
if (millis() - lastDataTime > 500) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nie zakładaj sztywnego czasu. W pliku konfiguracyjnym mamy zdefiniowany rogue time

Comment thread WST-FC/platformio.ini
br3ttb/PID@^1.2.1
adafruit/Adafruit ADXL345@^1.3.4
adafruit/Adafruit Unified Sensor@^1.1.14
esp32async/AsyncTCP@^3.4.10
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super! Dobrze że jest to async!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants