mirror of
https://github.com/modelec/detection_adversaire.git
synced 2026-03-18 21:30:27 +01:00
Patch erreurs messages TCP
This commit is contained in:
@@ -17,6 +17,13 @@ void Localization::setRobotPosition(int x, int y, int alpha) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Localization::setBeaconsPosition(pair<int, int> positions[3]){
|
||||||
|
for(unsigned int i = 0; i < 3; i++){
|
||||||
|
this->beaconsPositions[i] = positions[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Localization::setBeaconsMode(bool state){
|
void Localization::setBeaconsMode(bool state){
|
||||||
this->beaconsMode = state;
|
this->beaconsMode = state;
|
||||||
}
|
}
|
||||||
@@ -337,14 +344,19 @@ void Localization::handleMessage(const std::string &message) {
|
|||||||
vector<string> position = split(data, ",");
|
vector<string> position = split(data, ",");
|
||||||
this->setRobotPosition(stoi(position[0]), stoi(position[1]), stoi(position[2]));
|
this->setRobotPosition(stoi(position[0]), stoi(position[1]), stoi(position[2]));
|
||||||
}
|
}
|
||||||
if (contains(verb, "set beacon mode")) {
|
if (contains(verb, "set beacon")) {
|
||||||
//Enable or disable beacons triangulation
|
//Enable or disable beacons triangulation. This must be put to 0 if no beacons are on the table
|
||||||
this->setBeaconsMode(stoi(data));
|
this->setBeaconsMode(stoi(data));
|
||||||
}
|
}
|
||||||
if (contains(verb, "set beacon position")) {
|
if (contains(verb, "set team")) {
|
||||||
//Update beacons position
|
//Update beacons position
|
||||||
vector<string> position = split(data, ",");
|
if(stoi(data) == 0){
|
||||||
this->setRobotPosition(stoi(position[0]), stoi(position[1]), stoi(position[2]));
|
pair<int, int> positions[3] = BLUE_TEAM_BEACONS_POS;
|
||||||
|
this->setBeaconsPosition(positions);
|
||||||
|
} else if(stoi(data) == 1){
|
||||||
|
pair<int, int> positions[3] = YELLOW_TEAM_BEACONS_POS;
|
||||||
|
this->setBeaconsPosition(positions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (contains(verb, "get pos")) {
|
if (contains(verb, "get pos")) {
|
||||||
//ONLY IF ROBOT IS STOPPED : measure robot position from multiple lidar runs.
|
//ONLY IF ROBOT IS STOPPED : measure robot position from multiple lidar runs.
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#define AGGLOMERATES_TRIGGER 250
|
#define AGGLOMERATES_TRIGGER 250
|
||||||
#define BEACONS_RADIUS 50
|
#define BEACONS_RADIUS 50
|
||||||
#define TRIANGULATION_ROUNDS 3
|
#define TRIANGULATION_ROUNDS 3
|
||||||
|
#define YELLOW_TEAM_BEACONS_POS {make_pair(1,2), make_pair(3,4), make_pair(5,6)}
|
||||||
|
#define BLUE_TEAM_BEACONS_POS {make_pair(1,2), make_pair(3,4), make_pair(5,6)}
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -46,6 +48,7 @@ public:
|
|||||||
void setLidarHealth(bool ok);
|
void setLidarHealth(bool ok);
|
||||||
void setRobotPosition(int x, int y, int alpha);
|
void setRobotPosition(int x, int y, int alpha);
|
||||||
void setBeaconsMode(bool state);
|
void setBeaconsMode(bool state);
|
||||||
|
void setBeaconsPosition(pair<int, int> positions[3]);
|
||||||
[[nodiscard]] bool getLidarHealth() const;
|
[[nodiscard]] bool getLidarHealth() const;
|
||||||
[[nodiscard]] bool getBeaconsMode() const;
|
[[nodiscard]] bool getBeaconsMode() const;
|
||||||
[[nodiscard]] vector<int> getAvoidance() const;
|
[[nodiscard]] vector<int> getAvoidance() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user