35 #ifdef ACTIVELASERVIEW
91 ui.actionRemote->setChecked(
true);
93 uiSmall.actionRemote->setChecked(
true);
138 connect(
ui.checkBoxFaceTracking, SIGNAL( stateChanged(
int) ), SIGNAL(
enableFaceTracking(
int) ));
143 #ifndef BUILDFORROBOT
161 ui.actionDrive->setText(
"&Drive");
162 ui.actionDrive->setToolTip(
"Start driving");
163 ui.actionDrive->setStatusTip(
"Start driving");
167 uiSmall.actionDrive->setText(
"&Drive");
168 uiSmall.actionDrive->setToolTip(
"Start driving");
169 uiSmall.actionDrive->setStatusTip(
"Start driving");
176 #ifdef ACTIVELASERVIEW
180 delete widthLeftCircleFront;
181 delete widthRightCircleFront;
182 delete widthLineFront;
183 delete widthTextFront;
185 delete widthLeftCircleRear;
186 delete widthRightCircleRear;
187 delete widthLineRear;
188 delete widthTextRear;
191 while (!laserDistanceTextFront->isEmpty())
193 delete laserDistanceTextFront->takeFirst();
195 delete laserDistanceTextFront;
198 while (!laserDistanceLineListFront->isEmpty())
200 delete laserDistanceLineListFront->takeFirst();
202 delete laserDistanceLineListFront;
205 while (!laserLineListFront->isEmpty())
207 delete laserLineListFront->takeFirst();
209 delete laserLineListFront;
213 while (!laserDistanceTextRear->isEmpty())
215 delete laserDistanceTextRear->takeFirst();
217 delete laserDistanceTextRear;
220 while (!laserDistanceLineListRear->isEmpty())
222 delete laserDistanceLineListRear->takeFirst();
224 delete laserDistanceLineListRear;
227 while (!laserLineListRear->isEmpty())
229 delete laserLineListRear->takeFirst();
231 delete laserLineListRear;
271 ui.actionDrive->setEnabled(state);
272 ui.actionReset->setEnabled(state);
282 uiSmall.actionDrive->setEnabled(state);
283 uiSmall.actionReset->setEnabled(state);
311 if (addTimestamp ==
true)
314 now = QDateTime::currentDateTime();
317 text = QString(
"%1:%2:%3 %4").arg(
now.toString(
"hh")).arg(
now.toString(
"mm")).arg(
now.toString(
"ss")).arg(text);
323 ui.textEditGlobalLog->insertHtml(text);
327 uiSmall.textEditGlobalLog->insertHtml(text);
334 ui.textEditGlobalLog->insertHtml(
"<br>");
338 uiSmall.textEditGlobalLog->insertHtml(
"<br>");
345 ui.textEditGlobalLog->ensureCursorVisible();
349 uiSmall.textEditGlobalLog->ensureCursorVisible();
359 QByteArray textForConsole = text.toLatin1();
360 qDebug(
"%s", textForConsole.data());
378 now = QDateTime::currentDateTime();
380 newText = QString(
"%1:%2:%3 %4").arg(
now.toString(
"hh")).arg(
now.toString(
"mm")).arg(
now.toString(
"ss")).arg(text);
385 ui.textEditNetworkLog->insertHtml(newText);
389 uiSmall.textEditNetworkLog->insertHtml(newText);
397 ui.textEditNetworkLog->insertHtml(
"<br>");
401 uiSmall.textEditNetworkLog->insertHtml(
"<br>");
408 ui.textEditNetworkLog->ensureCursorVisible();
412 uiSmall.textEditNetworkLog->ensureCursorVisible();
422 QByteArray textForConsole = text.toLatin1();
423 qDebug(
"%s", textForConsole.data());
441 now = QDateTime::currentDateTime();
443 newText = QString(
"%1:%2:%3 %4").arg(
now.toString(
"hh")).arg(
now.toString(
"mm")).arg(
now.toString(
"ss")).arg(text);
448 ui.textEditSerialLog->insertHtml(newText);
452 uiSmall.textEditSerialLog->insertHtml(newText);
460 ui.textEditSerialLog->insertHtml(
"<br>");
464 uiSmall.textEditSerialLog->insertHtml(
"<br>");
471 ui.textEditSerialLog->ensureCursorVisible();
475 uiSmall.textEditSerialLog->ensureCursorVisible();
485 QByteArray textForConsole = text.toLatin1();
486 qDebug(
"%s", textForConsole.data());
493 static bool toggle =
false;
504 ui.actionDrive->setText(
"Stop &driving");
505 ui.actionDrive->setToolTip(
"Stop driving");
506 ui.actionDrive->setStatusTip(
"Stop driving");
510 uiSmall.actionDrive->setText(
"Stop &driving");
511 uiSmall.actionDrive->setToolTip(
"Stop driving");
512 uiSmall.actionDrive->setStatusTip(
"Stop driving");
528 ui.actionDrive->setText(
"&Drive");
529 ui.actionDrive->setToolTip(
"Start driving");
530 ui.actionDrive->setStatusTip(
"Start driving");
534 uiSmall.actionDrive->setText(
"&Drive");
535 uiSmall.actionDrive->setToolTip(
"Start driving");
536 uiSmall.actionDrive->setStatusTip(
"Start driving");
615 ui.labelDrivenDistance1->setText(
"0 cm");
616 ui.labelRevolutions1->setText(
"0");
620 uiSmall.labelDrivenDistance1->setText(
"0 cm");
621 uiSmall.labelRevolutions1->setText(
"0");
629 ui.labelDrivenDistance2->setText(
"0 cm");
630 ui.labelRevolutions2->setText(
"0");
634 uiSmall.labelDrivenDistance2->setText(
"0 cm");
635 uiSmall.labelRevolutions2->setText(
"0");
643 ui.labelDrivenDistance3->setText(
"0 cm");
644 ui.labelRevolutions3->setText(
"0");
648 uiSmall.labelDrivenDistance3->setText(
"0 cm");
649 uiSmall.labelRevolutions3->setText(
"0");
657 ui.labelDrivenDistance4->setText(
"0 cm");
658 ui.labelRevolutions4->setText(
"0");
662 uiSmall.labelDrivenDistance4->setText(
"0 cm");
663 uiSmall.labelRevolutions4->setText(
"0");
823 ui.dockVoltage->show();
825 ui.dockState->show();
832 if (
ui.dockCamera->isEnabled())
834 ui.dockCamera->show();
852 if (
ui.dockCamera->isVisible())
854 ui.dockCamera->hide();
858 ui.dockCamera->show();
875 if (
ui.dockVoltage->isVisible())
877 ui.dockVoltage->hide();
881 ui.dockVoltage->show();
928 if (
ui.dockState->isVisible())
930 ui.dockState->hide();
934 ui.dockState->show();
963 if (
ui.dockLog->isVisible())
1122 qDebug(
"ERROR gui, showDrivenDistance: wrong motor sensor number");
1132 ui.labelDrivenDistance1->setText(QString(
"%1 cm").arg(distance));
1136 uiSmall.labelDrivenDistance1->setText(QString(
"%1 cm").arg(distance));
1143 ui.labelDrivenDistance2->setText(QString(
"%1 cm").arg(distance));
1147 uiSmall.labelDrivenDistance2->setText(QString(
"%1 cm").arg(distance));
1154 ui.labelDrivenDistance3->setText(QString(
"%1 cm").arg(distance));
1158 uiSmall.labelDrivenDistance3->setText(QString(
"%1 cm").arg(distance));
1165 ui.labelDrivenDistance4->setText(QString(
"%1 cm").arg(distance));
1169 uiSmall.labelDrivenDistance4->setText(QString(
"%1 cm").arg(distance));
1181 qDebug(
"ERROR gui, showVoltage: wrong voltage sensor number");
1192 ui.lblVoltage1->setText(QString(
"%1").setNum(voltage,
'f', 1).append(
" V"));
1197 uiSmall.lblVoltage1->setText(QString(
"%1").setNum(voltage,
'f', 1).append(
" V"));
1209 ui.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-060.png"));
1213 uiSmall.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-060.png"));
1220 ui.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-missing.png"));
1224 uiSmall.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-missing.png"));
1233 ui.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-100.png"));
1237 uiSmall.lblBattery1->setPixmap(QPixmap(
":/images/images/battery-100.png"));
1246 ui.lblVoltage2->setText(QString(
"%1").setNum(voltage,
'f', 1).append(
" V"));
1251 uiSmall.lblVoltage2->setText(QString(
"%1").setNum(voltage,
'f', 1).append(
" V"));
1263 ui.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-060.png"));
1267 uiSmall.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-060.png"));
1274 ui.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-missing.png"));
1278 uiSmall.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-missing.png"));
1287 ui.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-100.png"));
1291 uiSmall.lblBattery2->setPixmap(QPixmap(
":/images/images/battery-100.png"));
1526 ui.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1530 uiSmall.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1542 ui.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1546 uiSmall.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1554 ui.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1558 uiSmall.lblLEDBackRight1->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1580 ui.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1584 uiSmall.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1596 ui.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1600 uiSmall.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1608 ui.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1612 uiSmall.lblLEDBackLeft2->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1634 ui.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1638 uiSmall.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1650 ui.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1654 uiSmall.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1662 ui.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1666 uiSmall.lblLEDFrontRight3->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1688 ui.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1692 uiSmall.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
1704 ui.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1708 uiSmall.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_green.gif"));
1716 ui.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1720 uiSmall.lblLEDFrontLeft4->setPixmap(QPixmap(
":/images/images/led_red.gif"));
1737 if (largestFreeAreaStart == -1)
1746 if (largestFreeAreaEnd == -1)
1758 ui.lblLaserFrontFreeArea->setText(QString(
"%1 - %2 deg").arg(largestFreeAreaStart).arg(largestFreeAreaEnd));
1760 ui.lblLaserFrontFreeCenter->setText(QString(
"%1 deg").arg(centerOfFreeWay));
1764 uiSmall.lblLaserFrontFreeArea->setText(QString(
"%1 - %2 deg").arg(largestFreeAreaStart).arg(largestFreeAreaEnd));
1766 uiSmall.lblLaserFrontFreeCenter->setText(QString(
"%1 deg").arg(centerOfFreeWay));
1781 ui.lblLaserFrontFreeWidth->setText(QString(
"%1").setNum(width,
'f', 0).append(
" cm"));
1785 uiSmall.lblLaserFrontFreeWidth->setText(QString(
"%1").setNum(width,
'f', 0).append(
" cm"));
1789 if ( width > configuredPassageWidth)
1793 ui.lblPassageWidth->setText( QString(
"> %1 cm").arg(configuredPassageWidth) );
1797 uiSmall.lblPassageWidth->setText( QString(
"> %1 cm").arg(configuredPassageWidth) );
1804 ui.lblPassageWidth->setText( QString(
"< %1 cm").arg(configuredPassageWidth) );
1808 uiSmall.lblPassageWidth->setText( QString(
"< %1 cm").arg(configuredPassageWidth) );
1816 ui.lblLaserFrontFreeWidth->setText(
"oo");
1820 uiSmall.lblLaserFrontFreeWidth->setText(
"oo");
1826 ui.lblPassageWidth->setText( QString(
"> %1 cm").arg(configuredPassageWidth) );
1830 uiSmall.lblPassageWidth->setText( QString(
"> %1 cm").arg(configuredPassageWidth) );
1835 #ifdef ACTIVELASERVIEW
1839 widthTextFront->setText(
ui.lblLaserFrontFreeWidth->text() );
1843 widthTextFront->setText(
uiSmall.lblLaserFrontFreeWidth->text() );
1851 if (direction ==
"FORWARD")
1855 ui.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/up.png"));
1859 uiSmall.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/up.png"));
1864 if (direction ==
"LEFT")
1868 ui.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/left.png"));
1872 uiSmall.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/left.png"));
1877 if (direction ==
"RIGHT")
1881 ui.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/right.png"));
1885 uiSmall.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/right.png"));
1890 if (direction ==
"NONE")
1894 ui.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/middle.png"));
1898 uiSmall.lblPreferredDirection->setPixmap(QPixmap(
":/images/images/middle.png"));
1903 appendLog(QString(
"ERROR: direction '%1' not supported in showPreferredDirection::Gui").arg(direction));
1909 if (direction ==
"UP")
1913 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/up.png"));
1917 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/up.png"));
1922 if (direction ==
"UPLEFT")
1926 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/upleft.png"));
1930 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/upleft.png"));
1935 if (direction ==
"UPRIGHT")
1939 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/upright.png"));
1943 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/upright.png"));
1948 if (direction ==
"DOWN")
1952 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/down.png"));
1956 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/down.png"));
1961 if (direction ==
"DOWNLEFT")
1965 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/downleft.png"));
1969 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/downleft.png"));
1974 if (direction ==
"DOWNRIGHT")
1978 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/downright.png"));
1982 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/downright.png"));
1987 if (direction ==
"LEFT")
1991 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/left.png"));
1995 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/left.png"));
2000 if (direction ==
"RIGHT")
2004 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/right.png"));
2008 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/right.png"));
2013 if (direction ==
"NONE")
2017 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/middle.png"));
2021 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/middle.png"));
2055 Q_UNUSED(faceRadius);
2056 Q_UNUSED(lastFaceX);
2057 Q_UNUSED(lastFaceY);
2066 ui.checkBoxFaceDetection->setEnabled(
false);
2067 ui.checkBoxFaceTracking->setEnabled(
false);
2071 uiSmall.checkBoxFaceDetection->setEnabled(
false);
2072 uiSmall.checkBoxFaceTracking->setEnabled(
false);
2082 ui.dockCamera->hide();
2103 ui.lblCamera->setPixmap(
pixmap.fromImage(*(image)));
2127 ui.lblCameraDepth->setPixmap(
pixmap.fromImage(*(image)));
2131 uiSmall.lblCameraDepth->setPixmap(
pixmap.fromImage(*(image)));
2140 ui.lblCameraOpenCV->setPixmap(
pixmap.fromImage(*(image)));
2144 uiSmall.lblCameraOpenCV->setPixmap(
pixmap.fromImage(*(image)));
2181 ui.spinBoxKinectAngle->setValue(0);
2185 uiSmall.spinBoxKinectAngle->setValue(0);
2306 #ifndef BUILDFORROBOT
2325 #ifndef BUILDFORROBOT
2344 #ifndef BUILDFORROBOT
2548 if (
ui.actionRemote->isChecked())
2550 ui.actionDrive->setEnabled(
false);
2557 ui.actionDrive->setEnabled(
true);
2564 if (
uiSmall.actionRemote->isChecked())
2566 uiSmall.actionDrive->setEnabled(
false);
2573 uiSmall.actionDrive->setEnabled(
true);
2585 if (
ui.actionSimulate->isChecked())
2587 ui.actionSimulate->setStatusTip(
"Disable simulation");
2588 ui.actionSimulate->setToolTip(
"Disable simulation");
2593 ui.actionSimulate->setStatusTip(
"Simulate");
2594 ui.actionSimulate->setToolTip(
"Simulate");
2600 if (
uiSmall.actionSimulate->isChecked())
2602 uiSmall.actionSimulate->setStatusTip(
"Disable simulation");
2603 uiSmall.actionSimulate->setToolTip(
"Disable simulation");
2608 uiSmall.actionSimulate->setStatusTip(
"Simulate");
2609 uiSmall.actionSimulate->setToolTip(
"Simulate");
2626 if (
ui.actionDemo->isChecked())
2637 if (
uiSmall.actionDemo->isChecked())
2655 #ifdef ACTIVELASERVIEW
2656 void Gui::on_sliderZoom_valueChanged(
int value)
2670 pixmapBot1->scale( (1 / (qreal)lastZoom), (1 / (qreal)lastZoom) );
2671 pixmapBot2->scale( (1 / (qreal)lastZoom), (1 / (qreal)lastZoom) );
2674 pixmapBot1->scale(value, value);
2675 pixmapBot2->scale(value, value);
2687 x = laserXPos - ( pixmapBot1->pixmap().width() / 2 / startScale * lastZoom);
2688 y = laserYPos - ( pixmapBot1->pixmap().height() / 2 / startScale * lastZoom);
2691 pixmapBot1->setPos(x, y);
2692 pixmapBot2->setPos(x, y);
2701 for (
int i=0; i<laserLineListFront->size(); i++)
2706 laserLineListFront->at(i)->setPos(x, y);
2716 for (
int i=0; i<laserLineListRear->size(); i++)
2721 laserLineListRear->at(i)->setPos(x, y);
2728 for (
int i=0; i<laserDistanceLineListFront->size(); i++)
2735 x = laserXPos - (newSize / 2);
2739 laserDistanceLineListFront->at(i)->setRect(0, 0, newSize, newSize);
2741 laserDistanceLineListFront->at(i)->setPos(x, y);
2746 y = laserYPos + (newSize/2);
2749 laserDistanceTextFront->at(i)->setPos(x, y);
2754 laserDistanceTextFront->at(i)->setText(text.left(text.indexOf(
".") + 3) +
"m");
2761 for (
int i=0; i<laserDistanceLineListRear->size(); i++)
2768 x = laserXPos - (newSize / 2);
2772 laserDistanceLineListRear->at(i)->setRect(0, 0, newSize, newSize);
2774 laserDistanceLineListRear->at(i)->setPos(x, y);
2779 y = laserYPos - (newSize/2);
2782 laserDistanceTextRear->at(i)->setPos(x, y);
2787 laserDistanceTextRear->at(i)->setText(text.left(text.indexOf(
".") + 3) +
"m");
2806 if (state == Qt::Checked)
2810 ui.checkBoxFaceTracking->setEnabled(
true);
2814 uiSmall.checkBoxFaceTracking->setEnabled(
true);
2821 ui.checkBoxFaceTracking->setEnabled(
false);
2825 uiSmall.checkBoxFaceTracking->setEnabled(
false);
2840 if (state == Qt::Unchecked)
2844 ui.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/middle.png"));
2848 uiSmall.lblFaceTrackTo->setPixmap(QPixmap(
":/images/images/middle.png"));
2854 #ifdef ACTIVELASERVIEW
2855 void Gui::initLaserView()
2883 laserXPos = (
ui.graphicsViewLaser->width() / 2);
2884 laserYPos = (
ui.graphicsViewLaser->height() / 2);
2888 laserXPos = (
uiSmall.graphicsViewLaser->width() / 2);
2889 laserYPos = (
uiSmall.graphicsViewLaser->height() / 2);
2907 while (i<laserLineListRear->size())
2909 laserLineListRear->at(i)->rotate(angle);
2928 while (i<laserLineListFront->size())
2930 laserLineListFront->at(i)->rotate(angle);
2939 on_sliderZoom_valueChanged(lastZoom);
2947 x = laserXPos - (laserDistanceLineListFront->at(0)->rect().width() / 2);
2948 y = laserYPos - (laserDistanceLineListFront->at(0)->rect().height() / 2);
2953 for (
int i=0; i<laserDistanceLineListFront->size(); i++)
2955 laserDistanceLineListFront->at(i)->setPos( (x - (i*LASERDISTANCEDISTANCE/2)), y - (i*LASERDISTANCEDISTANCE/2) );
2964 x = laserXPos - (laserDistanceLineListRear->at(0)->rect().width() / 2);
2965 y = laserYPos - (laserDistanceLineListRear->at(0)->rect().height() / 2);
2970 for (
int i=0; i<laserDistanceLineListRear->size(); i++)
2972 laserDistanceLineListRear->at(i)->setPos( (x - (i*LASERDISTANCEDISTANCE/2)), y - (i*LASERDISTANCEDISTANCE/2) );
2989 #ifdef ACTIVELASERVIEW
2990 void Gui::refreshLaserViewFront(QList <float> laserScannerValues, QList <int> laserScannerFlags)
3004 int laserLineLength = 0;
3008 zoomView =
ui.sliderZoom->value();
3012 zoomView =
uiSmall.sliderZoom->value();
3021 for (
int i=0; i<laserLineListFront->size(); i++)
3024 if (laserScannerFlags[i] ==
OBSTACLE)
3066 for (
int i=0; i<laserLineListFront->size(); i++)
3072 laserLineListFront->at(i)->setLine(0, 0, 0, laserLineLength);
3076 int flag = laserScannerFlags[i];
3083 string =
"OBSTACLE";
3086 string =
"LARGESTFREEWAY";
3089 string =
"CENTEROFLARGESTFREEWAY";
3092 string =
"IGNORETHIS";
3095 laserLineListFront->at(i)->setToolTip( QString(
"FRONT: %1 m, %2, %3 deg, %4 Pixel").arg(laserScannerValues[i]).arg(
string).arg(i).arg(laserLineLength) );
3099 x = laserLineListFront->at(i)->scenePos().x();
3100 y = laserLineListFront->at(i)->scenePos().y();
3207 widthLeftCircleFront->setVisible(
true);
3208 widthRightCircleFront->setVisible(
true);
3209 widthLineFront->setVisible(
true);
3214 #ifdef ACTIVELASERVIEW
3215 void Gui::refreshLaserViewRear(QList <float> laserScannerValues, QList <int> laserScannerFlags)
3223 static qreal widthLineRearPosX1 = 0.0;
3224 static qreal widthLineRearPosX2 = 0.0;
3225 static qreal widthLineRearPosY1 = 0.0;
3226 static qreal widthLineRearPosY2 = 0.0;
3227 int laserLineLength = 0;
3231 zoomView =
ui.sliderZoom->value();
3235 zoomView =
uiSmall.sliderZoom->value();
3244 for (
int i=0; i<laserLineListRear->size(); i++)
3254 if (laserScannerFlags[i] ==
OBSTACLE)
3288 for (
int i=0; i<laserLineListRear->size(); i++)
3294 laserLineListRear->at(i)->setLine(0, 0, 0, laserLineLength);
3297 laserLineListRear->at(i)->setToolTip( QString(
"REAR: %1 m / %2 deg / Flag=%3 / %4 Pixel").arg(laserScannerValues[i]).arg(i).arg(laserScannerFlags[i]).arg(laserLineLength) );
3300 x = laserLineListRear->at(i)->scenePos().x();
3301 y = laserLineListRear->at(i)->scenePos().y();
3307 r = laserLineListRear->at(i)->line().length();
3324 xKart = r * sin( angle *
M_PI / 180 );
3325 yKart = r * cos( angle *
M_PI / 180 );
3331 xKart += x - (widthCirclesWidth/2);
3332 yKart += y - (widthCirclesWidth/2);
3338 widthLineRearPosX1 = xKart + (widthCirclesWidth/2);
3339 widthLineRearPosY1 = yKart + (widthCirclesWidth/2);
3342 widthLeftCircleRear->setPos(xKart, yKart);
3349 r = laserLineListRear->at(i)->line().length();
3369 xKart = r * sin( angle *
M_PI / 180 );
3370 yKart = r * cos( angle *
M_PI / 180 );
3376 xKart += x - (widthCirclesWidth/2);
3377 yKart += y - (widthCirclesWidth/2);
3383 widthLineRearPosX2 = xKart + (widthCirclesWidth/2);
3384 widthLineRearPosY2 = yKart + (widthCirclesWidth/2);
3387 widthLineRear->setLine(widthLineRearPosX1, widthLineRearPosY1, widthLineRearPosX2, widthLineRearPosY2);
3390 widthRightCircleRear->setPos( widthLineRearPosX2 - (widthCirclesWidth/2), widthLineRearPosY2 - (widthCirclesWidth/2) );
3395 widthLeftCircleRear->setVisible(
true);
3396 widthRightCircleRear->setVisible(
true);
3397 widthLineRear->setVisible(
true);
3402 #ifdef ACTIVELASERVIEW
3403 void Gui::setRobotPosition(QGraphicsSceneMouseEvent* mouseEvent)
3408 laserYPos = mouseEvent->scenePos().y();
3412 laserXPos = mouseEvent->scenePos().x();
3417 on_sliderZoom_valueChanged(
ui.sliderZoom->value());
3421 on_sliderZoom_valueChanged(
uiSmall.sliderZoom->value());
3429 switch (laserscanner)
3441 qDebug(
"laser number not yet supported (Gui::setLaserscannerAngle");
3447 switch (laserscanner)
3459 qDebug(
"laser number not yet supported (Gui::setLaserscannerResolution");
3463 #ifdef ACTIVELASERVIEW
3464 void Gui::zoomLaserView(QGraphicsSceneWheelEvent* wheelEvent)
3471 zoomValue =
ui.sliderZoom->value();
3475 zoomValue =
uiSmall.sliderZoom->value();
3479 if (wheelEvent->delta() > 0)
3491 ui.sliderZoom->setValue(zoomValue);
3495 uiSmall.sliderZoom->setValue(zoomValue);
3501 #ifdef ACTIVELASERVIEW
3502 void Gui::createLaserScannerObjects()
3532 ui.graphicsViewLaser->setScene(scene);
3536 uiSmall.graphicsViewLaser->setScene(scene);
3542 ui.graphicsViewLaser->setViewport(
new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::DirectRendering)));
3546 uiSmall.graphicsViewLaser->setViewport(
new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::DirectRendering)));
3553 pixmapBot1 =
new QGraphicsPixmapItem(QPixmap(
":/images/images/bot_from_above.png"));
3558 lastZoom =
ui.sliderZoom->value();
3562 lastZoom =
uiSmall.sliderZoom->value();
3571 pixmapBot1->scale( (1.0 / startScale), (1.0 / startScale));
3574 pixmapBot1->setPos(laserXPos, laserYPos);
3577 scene->addItem(pixmapBot1);
3580 pixmapBot1->setZValue(2);
3586 laserLineListFront =
new QList <QGraphicsLineItem*>();
3587 laserLineListRear =
new QList <QGraphicsLineItem*>();
3597 QGraphicsLineItem *line =
new QGraphicsLineItem();
3600 line->setLine(0,0,0,0);
3610 laserLineListFront->append(line);
3613 scene->addItem(line);
3623 QGraphicsLineItem *line =
new QGraphicsLineItem();
3630 line->setLine(0,0,0,0);
3636 laserLineListRear->append(line);
3639 scene->addItem(line);
3646 pixmapBot2 =
new QGraphicsPixmapItem(QPixmap(
":/images/images/bot_from_above_TOP2.png"));
3649 pixmapBot2->scale( (1.0 / startScale), (1.0 / startScale));
3652 pixmapBot2->setPos(laserXPos, laserYPos);
3655 scene->addItem(pixmapBot2);
3658 pixmapBot2->setZValue(4);
3665 #ifdef ACTIVELASERVIEW
3666 void Gui::createLaserDistanceObjects()
3676 laserDistanceLineListFront =
new QList <QGraphicsEllipseItem*>();
3677 laserDistanceTextFront =
new QList <QGraphicsSimpleTextItem*>();
3687 QGraphicsSimpleTextItem *text =
new QGraphicsSimpleTextItem();
3690 semiCircle->setStartAngle(180*16);
3692 semiCircle->setSpanAngle(180*16);
3701 semiCircle->setZValue(1);
3705 laserDistanceLineListFront->append(semiCircle);
3706 laserDistanceTextFront->append(text);
3709 scene->addItem(semiCircle);
3712 scene->addItem(text);
3719 laserDistanceLineListRear =
new QList <QGraphicsEllipseItem*>();
3720 laserDistanceTextRear =
new QList <QGraphicsSimpleTextItem*>();
3730 QGraphicsSimpleTextItem *text =
new QGraphicsSimpleTextItem();
3733 semiCircle->setStartAngle(0);
3735 semiCircle->setSpanAngle(180*16);
3744 semiCircle->setZValue(1);
3748 laserDistanceLineListRear->append(semiCircle);
3749 laserDistanceTextRear->append(text);
3752 scene->addItem(semiCircle);
3755 scene->addItem(text);
3761 #ifdef ACTIVELASERVIEW
3762 void Gui::createLaserWidthObjects()
3764 widthCirclesWidth = 10;
3767 widthLeftCircleFront =
new QGraphicsEllipseItem();
3768 widthRightCircleFront =
new QGraphicsEllipseItem();
3769 widthLineFront =
new QGraphicsLineItem();
3770 widthTextFront =
new QGraphicsSimpleTextItem();
3772 widthLeftCircleRear =
new QGraphicsEllipseItem();
3773 widthRightCircleRear =
new QGraphicsEllipseItem();
3774 widthLineRear =
new QGraphicsLineItem();
3775 widthTextRear =
new QGraphicsSimpleTextItem();
3778 widthLeftCircleFront->setStartAngle(0*16);
3779 widthRightCircleFront->setStartAngle(0*16);
3781 widthLeftCircleFront->setSpanAngle(360*16);
3782 widthRightCircleFront->setSpanAngle(360*16);
3785 widthLeftCircleRear->setStartAngle(0*16);
3786 widthRightCircleRear->setStartAngle(0*16);
3788 widthLeftCircleRear->setSpanAngle(360*16);
3789 widthRightCircleRear->setSpanAngle(360*16);
3792 widthLeftCircleFront->setPen(QPen(Qt::blue));
3793 widthRightCircleFront->setPen(QPen(Qt::blue));
3794 widthLineFront->setPen(QPen(Qt::blue));
3795 widthTextFront->setPen(QPen(Qt::blue));
3797 widthLeftCircleRear->setPen(QPen(Qt::blue));
3798 widthRightCircleRear->setPen(QPen(Qt::blue));
3799 widthLineRear->setPen(QPen(Qt::blue));
3800 widthTextRear->setPen(QPen(Qt::blue));
3803 widthLeftCircleFront->setZValue(1);
3804 widthRightCircleFront->setZValue(1);
3805 widthLineFront->setZValue(1);
3806 widthTextFront->setZValue(1);
3808 widthLeftCircleRear->setZValue(1);
3809 widthRightCircleRear->setZValue(1);
3810 widthLineRear->setZValue(1);
3811 widthTextRear->setZValue(1);
3815 widthLeftCircleFront->setRect(0, 0, widthCirclesWidth, widthCirclesWidth);
3816 widthRightCircleFront->setRect(0, 0, widthCirclesWidth, widthCirclesWidth);
3818 widthLeftCircleRear->setRect(0, 0, widthCirclesWidth, widthCirclesWidth);
3819 widthRightCircleRear->setRect(0, 0, widthCirclesWidth, widthCirclesWidth);
3822 widthLeftCircleFront->setVisible(
false);
3823 widthRightCircleFront->setVisible(
false);
3824 widthLineFront->setVisible(
false);
3826 widthLeftCircleRear->setVisible(
false);
3827 widthRightCircleRear->setVisible(
false);
3828 widthLineRear->setVisible(
false);
3831 scene->addItem(widthLeftCircleFront);
3832 scene->addItem(widthRightCircleFront);
3833 scene->addItem(widthLineFront);
3834 scene->addItem(widthTextFront);
3836 scene->addItem(widthLeftCircleRear);
3837 scene->addItem(widthRightCircleRear);
3838 scene->addItem(widthLineRear);
3839 scene->addItem(widthTextRear);
3844 #ifdef ACTIVELASERVIEW
3845 void Gui::initLaserStuff()
3848 createLaserScannerObjects();
3849 createLaserDistanceObjects();
3850 createLaserWidthObjects();
3855 connect(scene, SIGNAL( robotPositionChanged(QGraphicsSceneMouseEvent *) ),
this, SLOT( setRobotPosition(QGraphicsSceneMouseEvent *) ));
3856 connect(scene, SIGNAL( wheelZoom(QGraphicsSceneWheelEvent *) ),
this, SLOT( zoomLaserView(QGraphicsSceneWheelEvent *) ));
3861 #ifndef BUILDFORROBOT
3895 QFont applicationFont = QApplication::font();
3917 curveCurrent1.setRenderHint(QwtPlotItem::RenderAntialiased);
3928 applicationFont = QApplication::font();
3946 curveCurrent2.setRenderHint(QwtPlotItem::RenderAntialiased);
3956 curveCurrent3.setRenderHint(QwtPlotItem::RenderAntialiased);
3965 curveCurrent4.setRenderHint(QwtPlotItem::RenderAntialiased);
3976 applicationFont = QApplication::font();
4004 curveVoltage1.setRenderHint(QwtPlotItem::RenderAntialiased);
4015 applicationFont = QApplication::font();
4043 curveVoltage2.setRenderHint(QwtPlotItem::RenderAntialiased);
4054 applicationFont = QApplication::font();
4209 ui.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4213 uiSmall.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4219 ui.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4223 uiSmall.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4229 ui.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4233 uiSmall.lblLEDHeartbeat->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4247 ui.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4251 uiSmall.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4257 ui.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4261 uiSmall.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4267 ui.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4271 uiSmall.lblLEDCompass->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4285 ui.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4289 uiSmall.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4295 ui.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4299 uiSmall.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4305 ui.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4309 uiSmall.lblLEDJoystick->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4323 ui.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4327 uiSmall.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4333 ui.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4337 uiSmall.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4343 ui.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4347 uiSmall.lblLEDCamera->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4361 ui.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4365 uiSmall.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4371 ui.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4375 uiSmall.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4381 ui.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4385 uiSmall.lblLEDNetwork->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4399 ui.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4403 uiSmall.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4409 ui.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4413 uiSmall.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4419 ui.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4423 uiSmall.lblLEDMasterSlave->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4437 ui.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4441 uiSmall.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_red.gif"));
4447 ui.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4451 uiSmall.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_green.gif"));
4457 ui.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4461 uiSmall.lblLEDLaser->setPixmap(QPixmap(
":/images/images/led_gray.gif"));
4472 ui.lblMasterSlave->setText(text);
4476 uiSmall.lblMasterSlave->setText(text);
4486 ui.spinBoxKinectAngle->setValue((
int) angle);
4490 uiSmall.spinBoxKinectAngle->setValue((
int) angle);
4499 ui.sliderThreshold->setValue(threshold);
4503 uiSmall.sliderThreshold->setValue(threshold);
4523 start = text.indexOf(
"<");
4524 text.remove(start, text.indexOf(
">") - start + 1);
4525 }
while (text.contains(
">"));
4534 if (errorlevel == -1)