mirror of
https://github.com/modelec/detection_adversaire.git
synced 2026-01-18 16:17:23 +01:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -332,7 +332,7 @@ void Localization::handleMessage(const std::string &message) {
|
||||
if (contains(verb, "stop")) {
|
||||
this->started = false;
|
||||
}
|
||||
if (contains(verb, "set position")) {
|
||||
if (contains(verb, "set pos")) {
|
||||
vector<string> position = split(data, ",");
|
||||
this->setRobotPosition(stoi(position[0]), stoi(position[1]), stoi(position[2]));
|
||||
}
|
||||
@@ -349,4 +349,4 @@ void Localization::handleMessage(const std::string &message) {
|
||||
|
||||
void Localization::sendProximityAlert(int distance, int angle) {
|
||||
this->sendMessage("all", "stop proximity", to_string(distance) + "," + to_string(angle));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
Localization localizer(-1, -1, -1, "127.0.0.1", port);
|
||||
localizer.start();
|
||||
localizer.sendMessage("strat", "ready", "1");
|
||||
//LIDAR connection
|
||||
sl::Result<sl::IChannel *> channel = sl::createSerialPortChannel("/dev/ttyUSB0", 115200);
|
||||
sl::Result<sl::IChannel *> channel = sl::createSerialPortChannel("/dev/USB_LIDAR", 115200);
|
||||
sl::ILidarDriver *drv = *sl::createLidarDriver();
|
||||
auto res = drv->connect(*channel);
|
||||
if (SL_IS_OK(res)) {
|
||||
@@ -36,6 +37,7 @@ int main(int argc, char* argv[]) {
|
||||
op_result = drv->getHealth(healthinfo);
|
||||
if (SL_IS_OK(op_result)) {
|
||||
localizer.setLidarHealth(true);
|
||||
localizer.sendMessage("strat", "ready", "1");
|
||||
}
|
||||
signal(SIGINT, stop_loop);
|
||||
while(true){
|
||||
|
||||
Reference in New Issue
Block a user