Compare commits
24 Commits
master
...
master-dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 13a4942562 | |||
| 5942c9b21a | |||
| 57c2b4ed3a | |||
| 2f59630197 | |||
| 069fa97b40 | |||
| 66bf6d5710 | |||
| 5c7caa3259 | |||
| 623ae0bedb | |||
| 04ae933f6e | |||
| 4970162ed5 | |||
| e1e80d16c7 | |||
| cb2b5fdcbd | |||
| bf368d6ac6 | |||
| 64a4b9b122 | |||
| 187c3ed9fc | |||
| 6b1012348c | |||
| 29db06e3c4 | |||
| 9483e265f3 | |||
| 117cf20765 | |||
| b843b8439e | |||
| b5566594b6 | |||
| a2b5557357 | |||
| 9f0074b534 | |||
| bf0ec30e16 |
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.8.2, 2019-07-10T11:42:03. -->
|
||||
<!-- Written by QtCreator 4.8.2, 2019-11-18T18:58:05. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "mqtt_callback.h"
|
||||
|
||||
mqtt_callback::mqtt_callback(mqtt::async_client *cli, std::shared_ptr<spdlog::logger> log) {
|
||||
mqtt_callback::mqtt_callback(mqtt::async_client *cli, std::shared_ptr<spdlog::logger> log, RoboGlue_SHARED *mem) {
|
||||
//initialize client pointer
|
||||
cli_=cli;
|
||||
log_=log;
|
||||
mem_= mem;
|
||||
}
|
||||
|
||||
void mqtt_callback::connected(const mqtt::string &cause) {
|
||||
@@ -17,6 +18,47 @@ void mqtt_callback::connection_lost(const mqtt::string &cause) {
|
||||
void mqtt_callback::message_arrived(mqtt::const_message_ptr msg) {
|
||||
log_->debug("Message Arrived: topic->{} - message->{}",
|
||||
msg->get_topic(), msg->to_string());
|
||||
if(msg->get_topic() == mem_->comSettings.subMap.find("interface")->second) {
|
||||
log_->debug("MQTT: Interface Message: {}", msg->get_payload().c_str());
|
||||
// Gestione dei messaggi di interfaccia
|
||||
std::vector<std::string> intMsg;
|
||||
boost::split(intMsg, static_cast<const std::string>(msg->to_string()), boost::is_any_of(":"));
|
||||
if (!intMsg[mem_->comSettings.TYPE].compare("STARTUP") ||
|
||||
!intMsg[mem_->comSettings.TYPE].compare("HB")){
|
||||
// Received Startup Message
|
||||
log_->debug("Startup/Heartbeat from node, ts: {},[{}]",
|
||||
intMsg[mem_->comSettings.NODE].c_str(),
|
||||
intMsg[mem_->comSettings.TS]);
|
||||
if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["relay"])){
|
||||
mem_->commonStatus.relayRunning = true;
|
||||
mem_->commonStatus.relayLast = std::stod(intMsg[mem_->comSettings.TS]);
|
||||
log_->trace("HB RELAY time: [{}]", mem_->commonStatus.relayLast);
|
||||
} else if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["follower"])) {
|
||||
mem_->commonStatus.followerRunning = true;
|
||||
mem_->commonStatus.followerLast = std::stod(intMsg[mem_->comSettings.TS]);
|
||||
log_->trace("HB FOLLOWER time: [{}]", mem_->commonStatus.followerLast);
|
||||
} else if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["recorder"])) {
|
||||
mem_->commonStatus.recorderRunning = true;
|
||||
mem_->commonStatus.recorderLast = std::stod(intMsg[mem_->comSettings.TS]);
|
||||
log_->trace("HB RECORDER time: [{}]", mem_->commonStatus.recorderLast);
|
||||
} else if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["broadcaster"])) {
|
||||
mem_->commonStatus.broadcasterRunning = true;
|
||||
mem_->commonStatus.broadcasterLast = std::stod(intMsg[mem_->comSettings.TS]);
|
||||
log_->trace("HB BROADCASTER time: [{}]", mem_->commonStatus.broadcasterLast);
|
||||
} else {
|
||||
log_->error("Node {} unknown", intMsg[mem_->comSettings.NODE].c_str());
|
||||
}
|
||||
//emit mem_->commonStatusChange();
|
||||
}
|
||||
} else if (msg->get_topic() == mem_->comSettings.subMap.find("state")->second){
|
||||
log_->debug("MQTT: State Message: {}", msg->get_payload().c_str());
|
||||
} else if (msg->get_topic() == mem_->comSettings.subMap.find("commands")->second){
|
||||
log_->debug("MQTT: Command Message: {}", msg->get_payload().c_str());
|
||||
} else if (msg->get_topic() == mem_->comSettings.subMap.find("coordinates")->second){
|
||||
log_->debug("MQTT: Coordinate Message: {}", msg->get_payload().c_str());
|
||||
} else {
|
||||
log_->error("Unrecognized topic: {}", msg->get_topic().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void mqtt_callback::delivery_complete(mqtt::delivery_token_ptr tok) {
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
#include <mqtt/client.h>
|
||||
#include <mqtt/callback.h>
|
||||
#include <spdlog/logger.h>
|
||||
#include <shared/roboglue_shared.h>
|
||||
|
||||
class mqtt_callback : public virtual mqtt::callback {
|
||||
|
||||
private:
|
||||
RoboGlue_SHARED *mem_;
|
||||
mqtt::async_client *cli_ = nullptr;
|
||||
std::shared_ptr<spdlog::logger> log_;
|
||||
|
||||
public:
|
||||
mqtt_callback(mqtt::async_client *cli, std::shared_ptr<spdlog::logger> log);
|
||||
mqtt_callback(mqtt::async_client *cli, std::shared_ptr<spdlog::logger> log,RoboGlue_SHARED *m);
|
||||
|
||||
void connected(const mqtt::string &cause) override;
|
||||
void connection_lost(const mqtt::string &cause) override;
|
||||
|
||||
@@ -5,8 +5,8 @@ RoboGlue_COM::RoboGlue_COM (RoboGlue_SHARED *mem): m(mem) {
|
||||
//////// SETUP LOGGER //////////
|
||||
liblog = spdlog::stdout_logger_mt("URcom_liblog");
|
||||
modlog = spdlog::stdout_logger_mt("RoboGlue_comlog");
|
||||
liblog->set_level(spdlog::level::info);
|
||||
modlog->set_level(spdlog::level::debug);
|
||||
liblog->set_level(spdlog::level::warn);
|
||||
modlog->set_level(spdlog::level::warn);
|
||||
|
||||
///////// INITIALIZE TCP SERVER ///////////
|
||||
server = new QTcpServer(this);
|
||||
@@ -16,7 +16,7 @@ RoboGlue_COM::RoboGlue_COM (RoboGlue_SHARED *mem): m(mem) {
|
||||
|
||||
//////// INITIALIZE MQTT CONNECTOR ///////
|
||||
client = new mqtt::async_client(std::string("tcp://localhost:1883"),"");
|
||||
callback = new mqtt_callback(client,modlog);////////////////////////////////////////////////
|
||||
callback = new mqtt_callback(client,modlog,m);////////////////////////////////////////////////
|
||||
//////// END EXTERNAL PUBLIC SLOTS /////////////
|
||||
////////////////////////////////////////////////
|
||||
baseMsg = m->commonSettings.baseMessage;
|
||||
@@ -35,9 +35,12 @@ void RoboGlue_COM::run() {
|
||||
client->set_callback(*callback);
|
||||
client->connect()->wait();
|
||||
// subscrbe to mqtt topics
|
||||
std::vector<std::string> subList = m->comSettings.subList;
|
||||
for (uint i=0; i < subList.size(); i++){
|
||||
client->subscribe(subList[i],0);
|
||||
try{
|
||||
for (auto it=m->comSettings.subMap.begin(); it != m->comSettings.subMap.end(); ++it){
|
||||
client->subscribe(it->second,0);
|
||||
}
|
||||
} catch (mqtt::exception &e) {
|
||||
modlog->error("MQTT Error {}", e.what());
|
||||
}
|
||||
client->start_consuming();
|
||||
|
||||
@@ -270,7 +273,7 @@ void RoboGlue_COM::timed_sendCoordinates(){
|
||||
baseMsg["value"]["rx"] = sp[3];
|
||||
baseMsg["value"]["ry"] = sp[4];
|
||||
baseMsg["value"]["rz"] = sp[5];
|
||||
MQTTpublish(baseMsg, m->comSettings.pubList[m->comSettings.COORD]);
|
||||
MQTTpublish(baseMsg, m->comSettings.pubMap.find("coordinates")->second);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////
|
||||
@@ -329,7 +332,7 @@ void RoboGlue_COM::on_sendROScommand(QString command, QVariantMap params) {
|
||||
baseMsg["command"] = command.toStdString();
|
||||
QJsonDocument jparam = QJsonDocument(QJsonObject::fromVariantMap(params));
|
||||
baseMsg["params"] = json::parse(jparam.toJson().data());
|
||||
MQTTpublish(baseMsg, m->comSettings.pubList[m->comSettings.COMM]);
|
||||
MQTTpublish(baseMsg, m->comSettings.pubMap.find("commands")->second);
|
||||
}
|
||||
|
||||
void RoboGlue_COM::on_sendROScoordinates(QList<double> sp) {
|
||||
@@ -350,41 +353,3 @@ void RoboGlue_COM::on_sendROSstate(QMap<std::string,bool> digital, QMap<std::str
|
||||
////////////////////////////////////////////////
|
||||
//////// END EXTERNAL PUBLIC SLOTS /////////////
|
||||
////////////////////////////////////////////////
|
||||
//void RoboGlue_COM::on_sendSetpointOLD(QList<double> sp) {
|
||||
// std::string setpoint;
|
||||
// struct {
|
||||
// union{
|
||||
// struct{
|
||||
// uint32_t x,y,z,a,b,c,keepalive;
|
||||
// };
|
||||
// char bytes[28];
|
||||
// };
|
||||
// } setPointBytes;
|
||||
// setPointBytes.keepalive=1;
|
||||
// int32_t v;
|
||||
// setpoint = "(";
|
||||
// for(uchar i=0; i<JOINT_NUMBER; i++){
|
||||
// v=static_cast<int32_t>(sp[i]*1000);
|
||||
// if (i>2) v=boost::algorithm::clamp(v, -2680,2680);
|
||||
// setpoint.append(std::to_string(v));
|
||||
// boost::algorithm::replace_all(setpoint, ",",".");
|
||||
// if(i<JOINT_NUMBER) setpoint.append("|");
|
||||
// }
|
||||
// setpoint.append("1");
|
||||
// boost::algorithm::replace_all(setpoint,"|",",");
|
||||
// setpoint.append(")");
|
||||
|
||||
// setPointBytes.x=htonl(static_cast<uint32_t>(sp[0]*1000));
|
||||
// setPointBytes.y=htonl(static_cast<uint32_t>(sp[1]*1000));
|
||||
// setPointBytes.z=htonl(static_cast<uint32_t>(sp[2]*1000));
|
||||
// setPointBytes.a=htonl(static_cast<uint32_t>(sp[3]*1000));
|
||||
// setPointBytes.b=htonl(static_cast<uint32_t>(sp[4]*1000));
|
||||
// setPointBytes.c=htonl(static_cast<uint32_t>(sp[5]*1000));
|
||||
// setPointBytes.keepalive=htonl(setPointBytes.keepalive);
|
||||
|
||||
// if(robotIN->write(setPointBytes.bytes,28))
|
||||
// modlog->trace("Sent Setpoint {}",setpoint.c_str());
|
||||
// robotIN->flush();
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
* della coda di destinazione.
|
||||
* 20190311 - La pubblicazione dei messaggi di coordinate verso ros deve essere a rateo costante
|
||||
* indipendentemente dalla frequenza di ingresso
|
||||
*/
|
||||
* 20191030 - Spostata la documentazione su GIT
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
|
||||
@@ -26,6 +26,8 @@ RoboGlue_GUI::RoboGlue_GUI(RoboGlue_SHARED *mem) : m(mem) {
|
||||
this, SLOT(deleteLater()), Qt::ConnectionType::QueuedConnection);
|
||||
connect(this, SIGNAL(pad_hoverEvent(QEvent *)),
|
||||
this, SLOT(on_pad_hoverEvent(QEvent *)));
|
||||
connect(m, SIGNAL(commonStatusChange()),
|
||||
this, SLOT(on_commonStatusChange()));
|
||||
|
||||
/////// READ NAME DEFINITION JSON FILE //////////
|
||||
try {
|
||||
@@ -89,6 +91,18 @@ void RoboGlue_GUI::disableLockAxes(){
|
||||
////////////////////////////////////////////////
|
||||
void RoboGlue_GUI::on_commonStatusChange() {
|
||||
modlog->trace("on_commonStatusChange Received");
|
||||
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.relayRunning) this->ui->lbl_relay->setStyleSheet("QLabel { background-color : red; color : white; }");
|
||||
else this->ui->lbl_relay->setStyleSheet("QLabel { background-color : green; color : white; }");
|
||||
if (!m->commonStatus.recorderRunning) this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : red; color : white; }");
|
||||
else this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : green; color : white; }");
|
||||
if (!m->commonStatus.followerRunning) this->ui->lbl_follower->setStyleSheet("QLabel { background-color : red; color : white; }");
|
||||
else this->ui->lbl_follower->setStyleSheet("QLabel { background-color : green; color : white; }");
|
||||
if (!m->commonStatus.broadcasterRunning) this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : red; color : white; }");
|
||||
else this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : green; color : white; }");
|
||||
}
|
||||
|
||||
void RoboGlue_GUI::on_pad_hoverEvent(QEvent* e) {
|
||||
@@ -196,6 +210,7 @@ void RoboGlue_GUI::on_btn_record_clicked() {
|
||||
param["metadata"] = metadata;
|
||||
ui->btn_play->setEnabled(false);
|
||||
ui->btn_realtime->setEnabled(false);
|
||||
ui->btn_home->setEnabled(false);
|
||||
disableLockAxes();
|
||||
} else {
|
||||
m->commonStatus.isRecording = false;
|
||||
@@ -203,6 +218,7 @@ void RoboGlue_GUI::on_btn_record_clicked() {
|
||||
param["action"]="stop";
|
||||
ui->btn_play->setEnabled(true);
|
||||
ui->btn_realtime->setEnabled(true);
|
||||
ui->btn_home->setEnabled(true);
|
||||
enableLockAxes();
|
||||
}
|
||||
emit m->commonStatusChange();
|
||||
@@ -223,6 +239,7 @@ void RoboGlue_GUI::on_btn_play_clicked() {
|
||||
param["lock"] = getLockAxes();
|
||||
ui->btn_record->setEnabled(false);
|
||||
ui->btn_realtime->setEnabled(false);
|
||||
ui->btn_home->setEnabled(false);
|
||||
ui->btn_play->setText("Stop");
|
||||
ui->txt_fileName->setEnabled(false);
|
||||
disableLockAxes();
|
||||
@@ -232,6 +249,7 @@ void RoboGlue_GUI::on_btn_play_clicked() {
|
||||
param["action"] = "stop";
|
||||
ui->btn_record->setEnabled(true);
|
||||
ui->btn_realtime->setEnabled(true);
|
||||
ui->btn_home->setEnabled(true);
|
||||
ui->btn_play->setText("Play");
|
||||
ui->txt_fileName->setEnabled(true);
|
||||
enableLockAxes();
|
||||
@@ -249,11 +267,12 @@ void RoboGlue_GUI::on_btn_open_clicked() {
|
||||
m->commonStatus.isFileOpen = true;
|
||||
fileOpen = true;
|
||||
metadata["name"] = ui->txt_fileName->text();
|
||||
metadata["plot"] = true;
|
||||
metadata["plot"] = ui->chk_plot->isChecked();
|
||||
param["action"] = "open";
|
||||
param["metadata"] = metadata;
|
||||
ui->btn_record->setEnabled(false);
|
||||
ui->btn_realtime->setEnabled(false);
|
||||
ui->btn_home->setEnabled(false);
|
||||
ui->btn_open->setText("Close");
|
||||
ui->txt_fileName->setEnabled(false);
|
||||
} else {
|
||||
@@ -262,6 +281,7 @@ void RoboGlue_GUI::on_btn_open_clicked() {
|
||||
param["action"] = "close";
|
||||
ui->btn_record->setEnabled(true);
|
||||
ui->btn_realtime->setEnabled(true);
|
||||
ui->btn_home->setEnabled(true);
|
||||
ui->btn_open->setText("Open");
|
||||
ui->txt_fileName->setEnabled(true);
|
||||
}
|
||||
@@ -295,6 +315,40 @@ void RoboGlue_GUI::on_btn_realtime_clicked() {
|
||||
emit m->commonStatusChange();
|
||||
emit sendROScommand("REALTIME", param);
|
||||
}
|
||||
|
||||
void RoboGlue_GUI::on_btn_home_clicked() {
|
||||
QVariantMap param;
|
||||
modlog->debug("robotHome");
|
||||
param["action"] = "start";
|
||||
param["execute"] = ui->chk_execute->isChecked();
|
||||
emit m->commonStatusChange();
|
||||
emit sendROScommand("HOME", param);
|
||||
}
|
||||
|
||||
void RoboGlue_GUI::on_btn_setFrame_clicked() {
|
||||
QVariantMap param, frm;
|
||||
QList<QString> tempPos, TempOr;
|
||||
modlog->debug("setFrame");
|
||||
param["action"]="set";
|
||||
param["framename"]=ui->txt_frameName->text();
|
||||
for(auto tp : ui->txt_framePos->text().split(",")){
|
||||
frm[tp.split(":").first()]=tp.split(":").last().replace(" ", "").toDouble();
|
||||
}
|
||||
for(auto tp : ui->txt_frameOr->text().split(",")){
|
||||
frm[tp.split(":").first()]=tp.split(":").last().replace(" ", "").toDouble();
|
||||
}
|
||||
param["frame"]=frm;
|
||||
emit m->commonStatusChange();
|
||||
emit sendROScommand("SETFRAME", param);
|
||||
}
|
||||
|
||||
void RoboGlue_GUI::on_btn_stopRos_clicked() {
|
||||
QVariantMap param;
|
||||
modlog->debug("stopRos");
|
||||
param["action"]=false;
|
||||
emit m->commonStatusChange();
|
||||
emit sendROScommand("QUIT", param);
|
||||
}
|
||||
////////////////////////////////////////////////
|
||||
////////END INTERNAL PRIVATE SLOTS//////////////
|
||||
////////////////////////////////////////////////
|
||||
@@ -339,5 +393,4 @@ void RoboGlue_GUI::on_newRobotData() {
|
||||
////////////////////////////////////////////////
|
||||
//////// END EXTERNAL PUBLIC SLOTS /////////////
|
||||
////////////////////////////////////////////////
|
||||
|
||||
|
||||
///
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
* 20190322 - Modifica dei nomi segnali tra questo modulo e com.
|
||||
* 20190402 - Aggiunte due spinbox per il settaggio di delta tempo e delta spazio da salvare nel
|
||||
* file dei metadati per la pianificazione dei persorsi salvati
|
||||
* 20191023 - Spostati i commenti in GIT
|
||||
*/
|
||||
|
||||
#include <QMainWindow>
|
||||
@@ -91,9 +92,13 @@ private slots:
|
||||
void on_btn_record_clicked();
|
||||
void on_btn_play_clicked();
|
||||
void on_btn_realtime_clicked();
|
||||
|
||||
void on_btn_home_clicked();
|
||||
void on_btn_open_clicked();
|
||||
|
||||
void on_btn_setFrame_clicked();
|
||||
|
||||
void on_btn_stopRos_clicked();
|
||||
|
||||
signals:
|
||||
void robotConnect(QString, uint port, uchar retry);
|
||||
void robotDisconnect();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>945</width>
|
||||
<height>750</height>
|
||||
<width>1018</width>
|
||||
<height>826</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
@@ -17,7 +17,7 @@
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tab_mainWindow">
|
||||
<property name="currentIndex">
|
||||
@@ -438,10 +438,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -457,10 +457,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -476,10 +476,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -498,10 +498,10 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -517,10 +517,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -536,10 +536,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -588,10 +588,10 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -607,10 +607,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -626,10 +626,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -645,10 +645,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -664,10 +664,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -683,10 +683,10 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByMouse</set>
|
||||
@@ -920,7 +920,7 @@
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QFrame" name="frm_move">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@@ -976,21 +976,30 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_posX">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_posY">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_posZ">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1037,7 +1046,21 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txt_fileName"/>
|
||||
<widget class="QLineEdit" name="txt_fileName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chk_plot">
|
||||
<property name="text">
|
||||
<string>Plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -1050,36 +1073,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_realtime">
|
||||
<property name="text">
|
||||
<string>RealTime</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>MODE:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rad_pos">
|
||||
<property name="text">
|
||||
<string>POS</string>
|
||||
@@ -1092,7 +1088,7 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rad_vel">
|
||||
<property name="text">
|
||||
<string>VEL</string>
|
||||
@@ -1102,6 +1098,59 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_realtime">
|
||||
<property name="text">
|
||||
<string>RealTime</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>MODE:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_home">
|
||||
<property name="text">
|
||||
<string>GoHOME</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chk_execute">
|
||||
<property name="text">
|
||||
<string>Execute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -1184,34 +1233,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>dS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>dT</string>
|
||||
@@ -1221,7 +1254,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spn_ds">
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
@@ -1237,7 +1270,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spn_dt">
|
||||
<property name="maximum">
|
||||
<double>240.000000000000000</double>
|
||||
@@ -1250,10 +1283,108 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>dS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Point Record Distance/Time</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="txt_framePos">
|
||||
<property name="inputMask">
|
||||
<string>\x:000,y:000,z:000 </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Orientation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="txt_frameOr">
|
||||
<property name="inputMask">
|
||||
<string>r\x:#00.0,ry:#00.0,rz:#00.0 </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btn_setFrame">
|
||||
<property name="text">
|
||||
<string>SetFrame</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="txt_frameName"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@@ -1283,6 +1414,52 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>ROS Status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_relay">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_follower">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_recorder">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_broadcaster">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_stopRos">
|
||||
<property name="text">
|
||||
<string>Stop_ROS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
@@ -1290,7 +1467,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>945</width>
|
||||
<width>1018</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -1312,12 +1489,12 @@
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="grp_mod"/>
|
||||
<buttongroup name="grp_hilo"/>
|
||||
<buttongroup name="gpr_lock">
|
||||
<property name="exclusive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</buttongroup>
|
||||
<buttongroup name="grp_mod"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@@ -5,7 +5,6 @@ RoboGlue_INIT::RoboGlue_INIT(QWidget *parent, const char*) : QMainWindow(parent)
|
||||
|
||||
//////// SETUP LOGGER //////////
|
||||
inilog = spdlog::stdout_logger_mt("RoboGlue_inilog");
|
||||
inilog->info("INIT Started");
|
||||
|
||||
//////// SETUP USER INTERFACE ///////
|
||||
ui = new Ui::RoboGlue_INIT;
|
||||
@@ -38,6 +37,9 @@ RoboGlue_INIT::RoboGlue_INIT(QWidget *parent, const char*) : QMainWindow(parent)
|
||||
|
||||
//////// CONNECT SIGNALS & SLOTS ///////
|
||||
connect(this, SIGNAL(destroyed()), this, SLOT(deleteLater()), Qt::ConnectionType::QueuedConnection);
|
||||
|
||||
//////// SIGNAL STARTED ////////////////
|
||||
inilog->info("INIT Started");
|
||||
}
|
||||
|
||||
RoboGlue_INIT::~RoboGlue_INIT() {
|
||||
|
||||
@@ -51,7 +51,7 @@ bool UR_CLinterface::connect(const char* ip, uint16_t port) {
|
||||
try {
|
||||
rsocket->connect(
|
||||
tcp::endpoint(boost::asio::ip::address::from_string(ip), port));
|
||||
if ((bool) rsocket->is_open()) {
|
||||
if (static_cast<bool>(rsocket->is_open())) {
|
||||
log->info("Connected to {0} on port {1}", ip, port);
|
||||
return true;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ void UR_CLinterface::sendCommand(std::string command) {
|
||||
char* dataOut=NULL;
|
||||
if (rsocket->is_open()){
|
||||
command = command + '\n';
|
||||
dataOut = (char*)malloc(command.size());
|
||||
dataOut = static_cast<char*>(malloc(command.size()));
|
||||
strncpy(dataOut, command.c_str(), command.size());
|
||||
log->debug("Sending: {}, s:{}",dataOut,command.size());
|
||||
boost::asio::write(*rsocket, boost::asio::buffer(dataOut, command.size()), error);
|
||||
@@ -106,7 +106,7 @@ void UR_CLinterface::parseData(void){
|
||||
subP = new versionSub(lastData, &clientData);
|
||||
subP->parse();
|
||||
firstMessage=false;
|
||||
long t=(long)clientData.versonMessage.timestamp;
|
||||
long t=static_cast<long>(clientData.versonMessage.timestamp);
|
||||
std::string timestr=std::string(asctime(gmtime(&t)));
|
||||
timestr.pop_back();
|
||||
log->info("Connection Time: {}", timestr);
|
||||
@@ -185,7 +185,7 @@ void UR_CLinterface::parseData(void){
|
||||
subP = new toolModeSub(&lastData[currIndex], &clientData);
|
||||
break;
|
||||
case SAFETY_DATA:
|
||||
//not yet implemented
|
||||
//TODO: not yet implemented
|
||||
break;
|
||||
default:
|
||||
log->error("Unknown Subpackage: {}", subPackageType);
|
||||
@@ -194,7 +194,7 @@ void UR_CLinterface::parseData(void){
|
||||
if (subP != NULL) subP->parse();
|
||||
currIndex+=subPackageSize;
|
||||
} catch (long sizediff){
|
||||
log->error("Package Length Mismatch: {}",sizediff);
|
||||
log->error("Package Length Mismatch: type_{:d}, diff_{:d}",subPackageType,sizediff);
|
||||
currIndex+=subPackageSize;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void UR_CLinterface::readData(void) {
|
||||
// all number are represented in network byte order, conversion required
|
||||
packlen = ntohl(packlen);
|
||||
// allocate memory for incoming package
|
||||
lastData = (unsigned char*)malloc(packlen);
|
||||
lastData = static_cast<unsigned char*>(malloc(packlen));
|
||||
// blocking read of exactly packlen bytes
|
||||
readata += boost::asio::read(*rsocket, receive_buffer,boost::asio::transfer_exactly(packlen), error);
|
||||
//retreive all data from buffer
|
||||
|
||||
@@ -366,6 +366,7 @@ namespace subpackage {
|
||||
v->feedriveButtonPressed = this->getUChar(&dataIn);
|
||||
v->feedriveButtonEnabled = this->getUChar(&dataIn);
|
||||
v->ioEnableFeedrive = this->getUChar(&dataIn);
|
||||
v->foo = this->getUChar(&dataIn);
|
||||
|
||||
// check if read data is aligned with package size
|
||||
if (dataIn-begin != size) throw dataIn-begin-size;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace subpackage {
|
||||
robotModeSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~robotModeSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -51,7 +51,7 @@ namespace subpackage {
|
||||
jointDataSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~jointDataSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -62,7 +62,7 @@ namespace subpackage {
|
||||
cartesianInfoSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~cartesianInfoSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -73,7 +73,7 @@ namespace subpackage {
|
||||
masterBoardSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~masterBoardSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -84,7 +84,7 @@ namespace subpackage {
|
||||
toolDataSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~toolDataSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -95,7 +95,7 @@ namespace subpackage {
|
||||
kineInfoSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~kineInfoSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -106,7 +106,7 @@ namespace subpackage {
|
||||
configurationSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~configurationSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -117,7 +117,7 @@ namespace subpackage {
|
||||
forceModeSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~forceModeSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -128,7 +128,7 @@ namespace subpackage {
|
||||
additionalInfoSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~additionalInfoSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -139,7 +139,7 @@ namespace subpackage {
|
||||
calibrationSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~calibrationSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -150,7 +150,7 @@ namespace subpackage {
|
||||
toolComSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~toolComSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -161,7 +161,7 @@ namespace subpackage {
|
||||
toolModeSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout;
|
||||
};
|
||||
}
|
||||
virtual ~toolModeSub();
|
||||
|
||||
uint32_t parse();
|
||||
@@ -171,7 +171,8 @@ namespace subpackage {
|
||||
public:
|
||||
versionSub(unsigned char* din, clientData_t* dout) {
|
||||
dataIn=din;
|
||||
dataOut=dout; };
|
||||
dataOut=dout;
|
||||
}
|
||||
virtual ~versionSub();
|
||||
|
||||
uint32_t parse();
|
||||
|
||||
@@ -273,6 +273,7 @@ typedef struct {
|
||||
unsigned char feedriveButtonPressed;
|
||||
unsigned char feedriveButtonEnabled;
|
||||
unsigned char ioEnableFeedrive;
|
||||
unsigned char foo;
|
||||
} additionalInfo_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ automain=false
|
||||
autotrack=false
|
||||
|
||||
[robot]
|
||||
connection\autoconnect=false
|
||||
connection\autoconnect=true
|
||||
connection\robotip=10.0.0.5
|
||||
connection\robotport=30002
|
||||
connection\robotretry=5
|
||||
@@ -40,3 +40,18 @@ kine\dhtable\size=6
|
||||
kine\maxreach=@Variant(\0\0\0\x87?\x99\x99\x9a)
|
||||
kine\prefix=0
|
||||
kine\suffix=0
|
||||
|
||||
[ros]
|
||||
deadTime=10
|
||||
ros_nodes\mqtt_publishers\commands=roboglue_com/com2ros/commands
|
||||
ros_nodes\mqtt_publishers\coordinates=roboglue_com/com2ros/coordinates
|
||||
ros_nodes\mqtt_publishers\interface=roboglue_com/com2ros/interface
|
||||
ros_nodes\mqtt_publishers\state=roboglue_com/com2ros/state
|
||||
ros_nodes\mqtt_subscribers\commands=roboglue_com/ros2com/commands
|
||||
ros_nodes\mqtt_subscribers\coordinates=roboglue_com/ros2com/coordinates
|
||||
ros_nodes\mqtt_subscribers\interface=roboglue_com/ros2com/interface
|
||||
ros_nodes\mqtt_subscribers\state=roboglue_com/ros2com/state
|
||||
ros_nodes\node_names\broadcaster=roboglue_ros_broadcaster
|
||||
ros_nodes\node_names\follower=roboglue_ros_follower
|
||||
ros_nodes\node_names\recorder=roboglue_ros_recorder
|
||||
ros_nodes\node_names\relay=roboglue_ros_relay
|
||||
|
||||
@@ -2,14 +2,34 @@
|
||||
|
||||
RoboGlue_SHARED::RoboGlue_SHARED(QSettings *set){
|
||||
settings=set;
|
||||
|
||||
//FIXME: inserire la lettura di quesste informazioni da un file
|
||||
robotVariables.insert(std::pair<std::string, int>("RDY",1));
|
||||
statusTimer = new QTimer(this);
|
||||
connect(statusTimer, SIGNAL(timeout()), this, SLOT(on_statusTimer()));
|
||||
statusTimer->start(static_cast<int>(comSettings.deadTime*1000));
|
||||
}
|
||||
|
||||
RoboGlue_SHARED::~RoboGlue_SHARED(){
|
||||
statusTimer->stop();
|
||||
delete statusTimer;
|
||||
}
|
||||
|
||||
void RoboGlue_SHARED::on_statusTimer(void){
|
||||
double curTime = static_cast<double>(std::time(NULL));
|
||||
commonStatus.relayRunning = (commonStatus.relayTime = fabs(commonStatus.relayLast - curTime)) < comSettings.deadTime;
|
||||
commonStatus.followerRunning = (commonStatus.followerTime = fabs(commonStatus.followerLast - curTime)) < comSettings.deadTime;
|
||||
commonStatus.recorderRunning = (commonStatus.recorderTime = fabs(commonStatus.recorderLast - curTime)) < comSettings.deadTime;
|
||||
commonStatus.broadcasterRunning = (commonStatus.broadcasterTime = fabs(commonStatus.broadcasterLast - curTime)) < comSettings.deadTime;
|
||||
emit this->commonStatusChange();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
/////////////////////// RESTORE FUNCTIONS /////////////////////
|
||||
/////////////////////////////////////////////////////////////
|
||||
void RoboGlue_SHARED::restoreCommonSettings(){
|
||||
settings->beginGroup("common");
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void RoboGlue_SHARED::restoreInitSettings(){
|
||||
settings->beginGroup("init");
|
||||
initSettings.size=settings->value("size").toSize();
|
||||
@@ -50,6 +70,29 @@ void RoboGlue_SHARED::restoreComSettings() {
|
||||
// TODO something
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
settings->beginGroup("ros");
|
||||
comSettings.deadTime = settings->value("deadTime").toDouble();
|
||||
settings->beginGroup("ros_nodes");
|
||||
settings->beginGroup("mqtt_publishers");
|
||||
comSettings.pubMap["commands"] = settings->value("commands").toString().toStdString();
|
||||
comSettings.pubMap["coordinates"] = settings->value("coordinates").toString().toStdString();
|
||||
comSettings.pubMap["state"] = settings->value("state").toString().toStdString();
|
||||
comSettings.pubMap["interface"] = settings->value("interface").toString().toStdString();
|
||||
settings->endGroup();
|
||||
settings->beginGroup("mqtt_subscribers");
|
||||
comSettings.subMap["commands"] = settings->value("commands").toString().toStdString();
|
||||
comSettings.subMap["coordinates"] = settings->value("coordinates").toString().toStdString();
|
||||
comSettings.subMap["state"] = settings->value("state").toString().toStdString();
|
||||
comSettings.subMap["interface"] = settings->value("interface").toString().toStdString();
|
||||
settings->endGroup();
|
||||
settings->beginGroup("node_names");
|
||||
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();
|
||||
}
|
||||
|
||||
void RoboGlue_SHARED::restoreGuiSettings() {
|
||||
@@ -74,7 +117,6 @@ void RoboGlue_SHARED::restoreTrackSettings() {
|
||||
void RoboGlue_SHARED::saveCommonSettings(){
|
||||
settings->beginGroup("common");
|
||||
settings->endGroup();
|
||||
|
||||
}
|
||||
|
||||
void RoboGlue_SHARED::saveInitSettings() {
|
||||
@@ -88,11 +130,34 @@ void RoboGlue_SHARED::saveInitSettings() {
|
||||
|
||||
void RoboGlue_SHARED::saveComSettings() {
|
||||
settings->beginGroup("robot");
|
||||
settings->beginGroup("kine");
|
||||
settings->setValue("maxreach", comSettings.kine.maxReach);
|
||||
settings->setValue("prefix", comSettings.connection.prefix);
|
||||
settings->setValue("suffix", comSettings.connection.suffix);
|
||||
settings->beginGroup("kine");
|
||||
settings->setValue("maxreach", comSettings.kine.maxReach);
|
||||
settings->setValue("prefix", comSettings.connection.prefix);
|
||||
settings->setValue("suffix", comSettings.connection.suffix);
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
settings->beginGroup("ros");
|
||||
settings->setValue("deadTime", comSettings.deadTime);
|
||||
settings->beginGroup("ros_nodes");
|
||||
settings->beginGroup("mqtt_publishers");
|
||||
settings->setValue("commands", QString().fromStdString(comSettings.pubMap.find("commands")->second));
|
||||
settings->setValue("coordinates", QString().fromStdString(comSettings.pubMap.find("coordinates")->second));
|
||||
settings->setValue("state", QString().fromStdString(comSettings.pubMap.find("state")->second));
|
||||
settings->setValue("interface", QString().fromStdString(comSettings.pubMap.find("interface")->second));
|
||||
settings->endGroup();
|
||||
settings->beginGroup("mqtt_subscribers");
|
||||
settings->setValue("commands", QString().fromStdString(comSettings.subMap.find("commands")->second));
|
||||
settings->setValue("coordinates", QString().fromStdString(comSettings.subMap.find("coordinates")->second));
|
||||
settings->setValue("state", QString().fromStdString(comSettings.subMap.find("state")->second));
|
||||
settings->setValue("interface", QString().fromStdString(comSettings.subMap.find("interface")->second));
|
||||
settings->endGroup();
|
||||
settings->beginGroup("node_names");
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,16 +21,19 @@
|
||||
* QUESTA COSA VA GIÀ CAMBIATA PERCHÈ È TROPPO CONFUSIONARIA!!
|
||||
* 20190124 - Implementati tutti i metodi che salvano e ripristinano le configurazioni.
|
||||
* 20190311 - Aggiunta la struttura che tiene gli stati che devono rimanere comuni ai moduli.
|
||||
*
|
||||
* 20191030 - Documentazione spostata in GIT
|
||||
*/
|
||||
|
||||
#include <QMutex>
|
||||
#include <QSettings>
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
#include <QTimer>
|
||||
#include <stdexcept>
|
||||
#include <ctime>
|
||||
#include <libJson/json.hpp>
|
||||
#include <libURcom/URCLinterface.h>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -39,7 +42,9 @@ class RoboGlue_SHARED : public QObject{
|
||||
|
||||
public:
|
||||
RoboGlue_SHARED(QSettings *set);
|
||||
virtual ~RoboGlue_SHARED();
|
||||
QMutex mutex;
|
||||
QTimer* statusTimer;
|
||||
|
||||
//////////// COMMON MODULES STATUS ///////////////
|
||||
struct {
|
||||
@@ -47,6 +52,20 @@ public:
|
||||
bool isPlaying = false;
|
||||
bool isRealtime = false;
|
||||
bool isFileOpen = false;
|
||||
// ROS node status
|
||||
bool relayRunning = false;
|
||||
bool followerRunning = false;
|
||||
bool recorderRunning = false;
|
||||
bool broadcasterRunning = false;
|
||||
// ROS node last seen
|
||||
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 /////////
|
||||
@@ -66,7 +85,7 @@ public:
|
||||
|
||||
struct {
|
||||
struct {
|
||||
std::string robotIp = std::string("192.168.0.31");
|
||||
std::string robotIp = std::string("localhost");
|
||||
uint robotPort = 30002;
|
||||
unsigned char retry = 5;
|
||||
bool autoConnect = false;
|
||||
@@ -77,19 +96,16 @@ public:
|
||||
kineDH_t DHtable;
|
||||
float maxReach = 1.2;
|
||||
} kine;
|
||||
std::vector<std::string> subList {
|
||||
{"roboglue_com/ros2com/commands"},
|
||||
{"roboglue_com/ros2com/coordinates"},
|
||||
{"roboglue_com/ros2com/state"}
|
||||
};
|
||||
std::vector<std::string> pubList {
|
||||
{"roboglue_com/com2ros/commands"},
|
||||
{"roboglue_com/com2ros/coordinates"},
|
||||
{"roboglue_com/com2ros/state"}
|
||||
};
|
||||
double deadTime = 1.0; //default value
|
||||
std::map<std::string, std::string> subMap;
|
||||
std::map<std::string, std::string> pubMap;
|
||||
std::map<std::string, std::string> nodeNames;
|
||||
enum {
|
||||
COMM, COORD, STAT
|
||||
} tList;
|
||||
enum {
|
||||
TYPE, NODE, TS
|
||||
};
|
||||
} comSettings;
|
||||
|
||||
struct {
|
||||
@@ -124,6 +140,9 @@ public:
|
||||
|
||||
signals:
|
||||
void commonStatusChange(void);
|
||||
|
||||
private slots:
|
||||
void on_statusTimer(void);
|
||||
};
|
||||
|
||||
#endif // ROBOGLUE_SHARED_H
|
||||
|
||||
Reference in New Issue
Block a user