Compare commits

...

5 Commits

Author SHA1 Message Date
b843b8439e Risolto problema in libURcom
package lenght mismatch per il pacchetto tipo 8 AdditionalInfo,
aggiunto uchar foo alla fine per far sparire l'errore.. chi sa perchè?
2019-10-29 10:39:35 +01:00
b5566594b6 Aggiornati offset assi (Simulazione) 2019-10-29 10:38:29 +01:00
a2b5557357 Aggiornate calibrazioni, interfaccia e progetto 2019-10-23 17:50:35 +02:00
9f0074b534 Aggiunto checkbox execute per l'homing 2019-10-23 17:49:26 +02:00
bf0ec30e16 Aggiunto pulsante per Homing Robot e relativo messaggio 2019-10-23 11:46:15 +02:00
10 changed files with 123 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2019-07-10T11:42:03. --> <!-- Written by QtCreator 4.8.2, 2019-10-23T17:47:47. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@@ -5,7 +5,7 @@ RoboGlue_COM::RoboGlue_COM (RoboGlue_SHARED *mem): m(mem) {
//////// SETUP LOGGER ////////// //////// SETUP LOGGER //////////
liblog = spdlog::stdout_logger_mt("URcom_liblog"); liblog = spdlog::stdout_logger_mt("URcom_liblog");
modlog = spdlog::stdout_logger_mt("RoboGlue_comlog"); modlog = spdlog::stdout_logger_mt("RoboGlue_comlog");
liblog->set_level(spdlog::level::info); liblog->set_level(spdlog::level::debug);
modlog->set_level(spdlog::level::debug); modlog->set_level(spdlog::level::debug);
///////// INITIALIZE TCP SERVER /////////// ///////// INITIALIZE TCP SERVER ///////////

View File

@@ -196,6 +196,7 @@ void RoboGlue_GUI::on_btn_record_clicked() {
param["metadata"] = metadata; param["metadata"] = metadata;
ui->btn_play->setEnabled(false); ui->btn_play->setEnabled(false);
ui->btn_realtime->setEnabled(false); ui->btn_realtime->setEnabled(false);
ui->btn_home->setEnabled(false);
disableLockAxes(); disableLockAxes();
} else { } else {
m->commonStatus.isRecording = false; m->commonStatus.isRecording = false;
@@ -203,6 +204,7 @@ void RoboGlue_GUI::on_btn_record_clicked() {
param["action"]="stop"; param["action"]="stop";
ui->btn_play->setEnabled(true); ui->btn_play->setEnabled(true);
ui->btn_realtime->setEnabled(true); ui->btn_realtime->setEnabled(true);
ui->btn_home->setEnabled(true);
enableLockAxes(); enableLockAxes();
} }
emit m->commonStatusChange(); emit m->commonStatusChange();
@@ -223,6 +225,7 @@ void RoboGlue_GUI::on_btn_play_clicked() {
param["lock"] = getLockAxes(); param["lock"] = getLockAxes();
ui->btn_record->setEnabled(false); ui->btn_record->setEnabled(false);
ui->btn_realtime->setEnabled(false); ui->btn_realtime->setEnabled(false);
ui->btn_home->setEnabled(false);
ui->btn_play->setText("Stop"); ui->btn_play->setText("Stop");
ui->txt_fileName->setEnabled(false); ui->txt_fileName->setEnabled(false);
disableLockAxes(); disableLockAxes();
@@ -232,6 +235,7 @@ void RoboGlue_GUI::on_btn_play_clicked() {
param["action"] = "stop"; param["action"] = "stop";
ui->btn_record->setEnabled(true); ui->btn_record->setEnabled(true);
ui->btn_realtime->setEnabled(true); ui->btn_realtime->setEnabled(true);
ui->btn_home->setEnabled(true);
ui->btn_play->setText("Play"); ui->btn_play->setText("Play");
ui->txt_fileName->setEnabled(true); ui->txt_fileName->setEnabled(true);
enableLockAxes(); enableLockAxes();
@@ -254,6 +258,7 @@ void RoboGlue_GUI::on_btn_open_clicked() {
param["metadata"] = metadata; param["metadata"] = metadata;
ui->btn_record->setEnabled(false); ui->btn_record->setEnabled(false);
ui->btn_realtime->setEnabled(false); ui->btn_realtime->setEnabled(false);
ui->btn_home->setEnabled(false);
ui->btn_open->setText("Close"); ui->btn_open->setText("Close");
ui->txt_fileName->setEnabled(false); ui->txt_fileName->setEnabled(false);
} else { } else {
@@ -262,6 +267,7 @@ void RoboGlue_GUI::on_btn_open_clicked() {
param["action"] = "close"; param["action"] = "close";
ui->btn_record->setEnabled(true); ui->btn_record->setEnabled(true);
ui->btn_realtime->setEnabled(true); ui->btn_realtime->setEnabled(true);
ui->btn_home->setEnabled(true);
ui->btn_open->setText("Open"); ui->btn_open->setText("Open");
ui->txt_fileName->setEnabled(true); ui->txt_fileName->setEnabled(true);
} }
@@ -295,6 +301,16 @@ void RoboGlue_GUI::on_btn_realtime_clicked() {
emit m->commonStatusChange(); emit m->commonStatusChange();
emit sendROScommand("REALTIME", param); 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);
}
//////////////////////////////////////////////// ////////////////////////////////////////////////
////////END INTERNAL PRIVATE SLOTS////////////// ////////END INTERNAL PRIVATE SLOTS//////////////
//////////////////////////////////////////////// ////////////////////////////////////////////////
@@ -339,5 +355,4 @@ void RoboGlue_GUI::on_newRobotData() {
//////////////////////////////////////////////// ////////////////////////////////////////////////
//////// END EXTERNAL PUBLIC SLOTS ///////////// //////// END EXTERNAL PUBLIC SLOTS /////////////
//////////////////////////////////////////////// ////////////////////////////////////////////////
///

View File

@@ -39,6 +39,7 @@
* 20190322 - Modifica dei nomi segnali tra questo modulo e com. * 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 * 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 * file dei metadati per la pianificazione dei persorsi salvati
* 20191023 - Spostati i commenti in GIT
*/ */
#include <QMainWindow> #include <QMainWindow>
@@ -91,7 +92,7 @@ private slots:
void on_btn_record_clicked(); void on_btn_record_clicked();
void on_btn_play_clicked(); void on_btn_play_clicked();
void on_btn_realtime_clicked(); void on_btn_realtime_clicked();
void on_btn_home_clicked();
void on_btn_open_clicked(); void on_btn_open_clicked();
signals: signals:

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>945</width> <width>1108</width>
<height>750</height> <height>760</height>
</rect> </rect>
</property> </property>
<property name="mouseTracking"> <property name="mouseTracking">
@@ -17,7 +17,7 @@
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QTabWidget" name="tab_mainWindow"> <widget class="QTabWidget" name="tab_mainWindow">
<property name="currentIndex"> <property name="currentIndex">
@@ -1050,36 +1050,9 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <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> <item>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="1">
<widget class="QRadioButton" name="rad_pos"> <widget class="QRadioButton" name="rad_pos">
<property name="text"> <property name="text">
<string>POS</string> <string>POS</string>
@@ -1092,7 +1065,7 @@
</attribute> </attribute>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="1">
<widget class="QRadioButton" name="rad_vel"> <widget class="QRadioButton" name="rad_vel">
<property name="text"> <property name="text">
<string>VEL</string> <string>VEL</string>
@@ -1102,6 +1075,59 @@
</attribute> </attribute>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>
@@ -1290,7 +1316,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>945</width> <width>1108</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@@ -1313,11 +1339,11 @@
<connections/> <connections/>
<buttongroups> <buttongroups>
<buttongroup name="grp_mod"/> <buttongroup name="grp_mod"/>
<buttongroup name="grp_hilo"/>
<buttongroup name="gpr_lock"> <buttongroup name="gpr_lock">
<property name="exclusive"> <property name="exclusive">
<bool>false</bool> <bool>false</bool>
</property> </property>
</buttongroup> </buttongroup>
<buttongroup name="grp_hilo"/>
</buttongroups> </buttongroups>
</ui> </ui>

View File

@@ -51,7 +51,7 @@ bool UR_CLinterface::connect(const char* ip, uint16_t port) {
try { try {
rsocket->connect( rsocket->connect(
tcp::endpoint(boost::asio::ip::address::from_string(ip), port)); 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); log->info("Connected to {0} on port {1}", ip, port);
return true; return true;
} }
@@ -75,7 +75,7 @@ void UR_CLinterface::sendCommand(std::string command) {
char* dataOut=NULL; char* dataOut=NULL;
if (rsocket->is_open()){ if (rsocket->is_open()){
command = command + '\n'; command = command + '\n';
dataOut = (char*)malloc(command.size()); dataOut = static_cast<char*>(malloc(command.size()));
strncpy(dataOut, command.c_str(), command.size()); strncpy(dataOut, command.c_str(), command.size());
log->debug("Sending: {}, s:{}",dataOut,command.size()); log->debug("Sending: {}, s:{}",dataOut,command.size());
boost::asio::write(*rsocket, boost::asio::buffer(dataOut, command.size()), error); 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 = new versionSub(lastData, &clientData);
subP->parse(); subP->parse();
firstMessage=false; firstMessage=false;
long t=(long)clientData.versonMessage.timestamp; long t=static_cast<long>(clientData.versonMessage.timestamp);
std::string timestr=std::string(asctime(gmtime(&t))); std::string timestr=std::string(asctime(gmtime(&t)));
timestr.pop_back(); timestr.pop_back();
log->info("Connection Time: {}", timestr); log->info("Connection Time: {}", timestr);
@@ -185,7 +185,7 @@ void UR_CLinterface::parseData(void){
subP = new toolModeSub(&lastData[currIndex], &clientData); subP = new toolModeSub(&lastData[currIndex], &clientData);
break; break;
case SAFETY_DATA: case SAFETY_DATA:
//not yet implemented //TODO: not yet implemented
break; break;
default: default:
log->error("Unknown Subpackage: {}", subPackageType); log->error("Unknown Subpackage: {}", subPackageType);
@@ -194,7 +194,7 @@ void UR_CLinterface::parseData(void){
if (subP != NULL) subP->parse(); if (subP != NULL) subP->parse();
currIndex+=subPackageSize; currIndex+=subPackageSize;
} catch (long sizediff){ } catch (long sizediff){
log->error("Package Length Mismatch: {}",sizediff); log->error("Package Length Mismatch: type_{:d}, diff_{:d}",subPackageType,sizediff);
currIndex+=subPackageSize; currIndex+=subPackageSize;
} }
} }
@@ -225,7 +225,7 @@ void UR_CLinterface::readData(void) {
// all number are represented in network byte order, conversion required // all number are represented in network byte order, conversion required
packlen = ntohl(packlen); packlen = ntohl(packlen);
// allocate memory for incoming package // allocate memory for incoming package
lastData = (unsigned char*)malloc(packlen); lastData = static_cast<unsigned char*>(malloc(packlen));
// blocking read of exactly packlen bytes // blocking read of exactly packlen bytes
readata += boost::asio::read(*rsocket, receive_buffer,boost::asio::transfer_exactly(packlen), error); readata += boost::asio::read(*rsocket, receive_buffer,boost::asio::transfer_exactly(packlen), error);
//retreive all data from buffer //retreive all data from buffer

View File

@@ -366,6 +366,7 @@ namespace subpackage {
v->feedriveButtonPressed = this->getUChar(&dataIn); v->feedriveButtonPressed = this->getUChar(&dataIn);
v->feedriveButtonEnabled = this->getUChar(&dataIn); v->feedriveButtonEnabled = this->getUChar(&dataIn);
v->ioEnableFeedrive = this->getUChar(&dataIn); v->ioEnableFeedrive = this->getUChar(&dataIn);
v->foo = this->getUChar(&dataIn);
// check if read data is aligned with package size // check if read data is aligned with package size
if (dataIn-begin != size) throw dataIn-begin-size; if (dataIn-begin != size) throw dataIn-begin-size;

View File

@@ -40,7 +40,7 @@ namespace subpackage {
robotModeSub(unsigned char* din, clientData_t* dout) { robotModeSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~robotModeSub(); virtual ~robotModeSub();
uint32_t parse(); uint32_t parse();
@@ -51,7 +51,7 @@ namespace subpackage {
jointDataSub(unsigned char* din, clientData_t* dout) { jointDataSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~jointDataSub(); virtual ~jointDataSub();
uint32_t parse(); uint32_t parse();
@@ -62,7 +62,7 @@ namespace subpackage {
cartesianInfoSub(unsigned char* din, clientData_t* dout) { cartesianInfoSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~cartesianInfoSub(); virtual ~cartesianInfoSub();
uint32_t parse(); uint32_t parse();
@@ -73,7 +73,7 @@ namespace subpackage {
masterBoardSub(unsigned char* din, clientData_t* dout) { masterBoardSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~masterBoardSub(); virtual ~masterBoardSub();
uint32_t parse(); uint32_t parse();
@@ -84,7 +84,7 @@ namespace subpackage {
toolDataSub(unsigned char* din, clientData_t* dout) { toolDataSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~toolDataSub(); virtual ~toolDataSub();
uint32_t parse(); uint32_t parse();
@@ -95,7 +95,7 @@ namespace subpackage {
kineInfoSub(unsigned char* din, clientData_t* dout) { kineInfoSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~kineInfoSub(); virtual ~kineInfoSub();
uint32_t parse(); uint32_t parse();
@@ -106,7 +106,7 @@ namespace subpackage {
configurationSub(unsigned char* din, clientData_t* dout) { configurationSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~configurationSub(); virtual ~configurationSub();
uint32_t parse(); uint32_t parse();
@@ -117,7 +117,7 @@ namespace subpackage {
forceModeSub(unsigned char* din, clientData_t* dout) { forceModeSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~forceModeSub(); virtual ~forceModeSub();
uint32_t parse(); uint32_t parse();
@@ -128,7 +128,7 @@ namespace subpackage {
additionalInfoSub(unsigned char* din, clientData_t* dout) { additionalInfoSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~additionalInfoSub(); virtual ~additionalInfoSub();
uint32_t parse(); uint32_t parse();
@@ -139,7 +139,7 @@ namespace subpackage {
calibrationSub(unsigned char* din, clientData_t* dout) { calibrationSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~calibrationSub(); virtual ~calibrationSub();
uint32_t parse(); uint32_t parse();
@@ -150,7 +150,7 @@ namespace subpackage {
toolComSub(unsigned char* din, clientData_t* dout) { toolComSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~toolComSub(); virtual ~toolComSub();
uint32_t parse(); uint32_t parse();
@@ -161,7 +161,7 @@ namespace subpackage {
toolModeSub(unsigned char* din, clientData_t* dout) { toolModeSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; dataOut=dout;
}; }
virtual ~toolModeSub(); virtual ~toolModeSub();
uint32_t parse(); uint32_t parse();
@@ -171,7 +171,8 @@ namespace subpackage {
public: public:
versionSub(unsigned char* din, clientData_t* dout) { versionSub(unsigned char* din, clientData_t* dout) {
dataIn=din; dataIn=din;
dataOut=dout; }; dataOut=dout;
}
virtual ~versionSub(); virtual ~versionSub();
uint32_t parse(); uint32_t parse();

View File

@@ -273,6 +273,7 @@ typedef struct {
unsigned char feedriveButtonPressed; unsigned char feedriveButtonPressed;
unsigned char feedriveButtonEnabled; unsigned char feedriveButtonEnabled;
unsigned char ioEnableFeedrive; unsigned char ioEnableFeedrive;
unsigned char foo;
} additionalInfo_t; } additionalInfo_t;
typedef struct { typedef struct {

View File

@@ -12,30 +12,30 @@ connection\autoconnect=false
connection\robotip=10.0.0.5 connection\robotip=10.0.0.5
connection\robotport=30002 connection\robotport=30002
connection\robotretry=5 connection\robotretry=5
kine\dhtable\1\dha=0 kine\dhtable\1\dha=6.94460589082162e-310
kine\dhtable\1\dhalpha=0 kine\dhtable\1\dhalpha=6.9446058912971e-310
kine\dhtable\1\dhd=0 kine\dhtable\1\dhd=1.099340831232476e+248
kine\dhtable\1\dhtheta=0 kine\dhtable\1\dhtheta=1.332e-320
kine\dhtable\2\dha=0 kine\dhtable\2\dha=0
kine\dhtable\2\dhalpha=0 kine\dhtable\2\dhalpha=6.9446058912884e-310
kine\dhtable\2\dhd=0 kine\dhtable\2\dhd=1.3849777432376169e+219
kine\dhtable\2\dhtheta=0 kine\dhtable\2\dhtheta=6.9446058913382e-310
kine\dhtable\3\dha=0 kine\dhtable\3\dha=0
kine\dhtable\3\dhalpha=0 kine\dhtable\3\dhalpha=5.53e-322
kine\dhtable\3\dhd=0 kine\dhtable\3\dhd=2.44861994589e-312
kine\dhtable\3\dhtheta=0 kine\dhtable\3\dhtheta=8e-323
kine\dhtable\4\dha=0 kine\dhtable\4\dha=2.37e-322
kine\dhtable\4\dhalpha=0 kine\dhtable\4\dhalpha=2.37e-322
kine\dhtable\4\dhd=0 kine\dhtable\4\dhd=0
kine\dhtable\4\dhtheta=0 kine\dhtable\4\dhtheta=0
kine\dhtable\5\dha=0 kine\dhtable\5\dha=2.57e-322
kine\dhtable\5\dhalpha=0 kine\dhtable\5\dhalpha=2.57e-322
kine\dhtable\5\dhd=0 kine\dhtable\5\dhd=2.06e-321
kine\dhtable\5\dhtheta=0 kine\dhtable\5\dhtheta=8.74e-322
kine\dhtable\6\dha=0 kine\dhtable\6\dha=6.9446058915066e-310
kine\dhtable\6\dhalpha=0 kine\dhtable\6\dhalpha=6.9446058913493e-310
kine\dhtable\6\dhd=0 kine\dhtable\6\dhd=6.94460589137854e-310
kine\dhtable\6\dhtheta=0 kine\dhtable\6\dhtheta=6.94460589137854e-310
kine\dhtable\size=6 kine\dhtable\size=6
kine\maxreach=@Variant(\0\0\0\x87?\x99\x99\x9a) kine\maxreach=@Variant(\0\0\0\x87?\x99\x99\x9a)
kine\prefix=0 kine\prefix=0