Fixing bugs, more freq updated

This commit is contained in:
Vladislav Khorev committed 2026-01-17 15:03:37 +03:00
1 parent e0a60dcd6f
commit 3c55b59c8d
6 files changed
+136 -28

No files matched your search

+3 -4
View File
@@ -42,9 +42,6 @@ class Session : public std::enable_shared_from_this<Session> {
void process_message(const std::string& msg) {
auto now_server = std::chrono::system_clock::now();
// Ïðåäïîëîæèì ôîðìàò ñîîáùåíèé:
// ROT:ANGLE:MAG:TIMESTAMP
// VEL:SELECTED_VEL:TIMESTAMP
auto parts = split(msg, ':');
if (parts.empty()) return;
@@ -73,6 +70,7 @@ class Session : public std::enable_shared_from_this<Session> {
if (parts[0] == "ROT") {
state_.discreteAngle = std::stoi(parts[2]);
state_.discreteMag = std::stof(parts[3]);
state_.handle_full_sync(parts, 4);
std::cout << "ROT id = " << this->id_ << " discreteMag=" << state_.discreteMag << std::endl;
state_.apply_lag_compensation(now_server);
state_.lastUpdateServerTime = now_server;
@@ -80,12 +78,13 @@ class Session : public std::enable_shared_from_this<Session> {
}
else if (parts[0] == "VEL") {
state_.selectedVelocity = std::stoi(parts[2]);
state_.handle_full_sync(parts, 3);
state_.apply_lag_compensation(now_server);
state_.lastUpdateServerTime = now_server;
retranslateMessage(msg);
}
else if (parts[0] == "PING") {
state_.handle_full_sync(parts);
state_.handle_full_sync(parts, 2);
std::cout << "PING id = " << this->id_ <<" discreteMag=" << state_.discreteMag << std::endl;
state_.apply_lag_compensation(now_server);
state_.lastUpdateServerTime = now_server;