Aggiunto nodo broadcaster a interfaccia e shared memory

This commit is contained in:
2019-11-15 14:49:45 +01:00
parent 623ae0bedb
commit 5c7caa3259
4 changed files with 18 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2019-11-12T17:05:54. -->
<!-- Written by QtCreator 4.8.2, 2019-11-14T17:08:08. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -95,17 +95,21 @@ void RoboGlue_GUI::on_commonStatusChange() {
this->ui->lbl_relay->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("relay")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.relayTime))));
this->ui->lbl_follower->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("follower")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.followerTime))));
this->ui->lbl_recorder->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("recorder")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.recorderTime))));
this->ui->lbl_broadcaster->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("broadcaster")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.broadcasterTime))));
if(m->commonStatus.relayTime > m->comSettings.deadTime ||
m->commonStatus.followerTime > m->comSettings.deadTime ||
m->commonStatus.recorderTime > m->comSettings.deadTime) {
m->commonStatus.recorderTime > m->comSettings.deadTime ||
m->commonStatus.broadcasterTime > m->comSettings.deadTime) {
this->ui->lbl_relay->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_follower->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : red; color : white; }");
} else {
this->ui->lbl_relay->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_follower->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : green; color : white; }");
}
}

View File

@@ -19,6 +19,7 @@ void RoboGlue_SHARED::on_statusTimer(void){
commonStatus.relayTime = fabs(commonStatus.relayLast - curTime);
commonStatus.followerTime = fabs(commonStatus.followerLast - curTime);
commonStatus.recorderTime = fabs(commonStatus.recorderLast - curTime);
commonStatus.broadcasterTime = fabs(commonStatus.broadcasterLast - curTime);
emit this->commonStatusChange();
}
////////////////////////////////////////////////////////////////
@@ -88,6 +89,7 @@ void RoboGlue_SHARED::restoreComSettings() {
comSettings.nodeNames["relay"] = settings->value("relay").toString().toStdString();
comSettings.nodeNames["follower"] = settings->value("follower").toString().toStdString();
comSettings.nodeNames["recorder"] = settings->value("recorder").toString().toStdString();
comSettings.nodeNames["broadcaster"] = settings->value("broadcaster").toString().toStdString();
settings->endGroup();
settings->endGroup();
settings->endGroup();
@@ -153,6 +155,7 @@ void RoboGlue_SHARED::saveComSettings() {
settings->setValue("relay", QString().fromStdString(comSettings.nodeNames.find("relay")->second));
settings->setValue("follower", QString().fromStdString(comSettings.nodeNames.find("follower")->second));
settings->setValue("recorder", QString().fromStdString(comSettings.nodeNames.find("recorder")->second));
settings->setValue("broadcaster", QString().fromStdString(comSettings.nodeNames.find("broadcaster")->second));
settings->endGroup();
settings->endGroup();
settings->endGroup();

View File

@@ -30,6 +30,7 @@
#include <QSize>
#include <QTimer>
#include <stdexcept>
#include <ctime>
#include <libJson/json.hpp>
#include <libURcom/URCLinterface.h>
#include <boost/algorithm/string.hpp>
@@ -56,12 +57,14 @@ public:
bool followerRunning = false;
bool recorderRunning = false;
// ROS node last seen
double relayLast = 0.0;
double followerLast = 0.0;
double recorderLast = 0.0;
double relayTime = 0.0;
double followerTime = 0.0;
double recorderTime = 0.0;
double relayLast = static_cast<double>(time(NULL));
double followerLast = static_cast<double>(time(NULL));
double recorderLast = static_cast<double>(time(NULL));
double broadcasterLast = static_cast<double>(time(NULL));
double relayTime = static_cast<double>(time(NULL));
double followerTime = static_cast<double>(time(NULL));
double recorderTime = static_cast<double>(time(NULL));
double broadcasterTime = static_cast<double>(time(NULL));
} commonStatus;
/////////// PERMANENT SETTINGS VARIABLES /////////