From 3f55aa3a73fe97a92b596fc326fa9eb8ac3f4ed4 Mon Sep 17 00:00:00 2001 From: Francisco Perez Date: Sun, 12 Jun 2016 17:55:13 +0200 Subject: [PATCH] [issue #442] Reduced uav_viewer GUI to be more usable --- src/stable/tools/uav_viewer/CMakeLists.txt | 8 +- .../tools/uav_viewer/gui/datawidget.cpp | 396 ++++++++++++++++++ src/stable/tools/uav_viewer/gui/datawidget.h | 81 ++++ .../tools/uav_viewer/gui/mainwindow.cpp | 374 +---------------- src/stable/tools/uav_viewer/gui/mainwindow.h | 25 +- .../tools/uav_viewer/gui/ui_mainwindow.h | 97 +---- src/stable/tools/uav_viewer/gui/velwidget.cpp | 127 ++++++ src/stable/tools/uav_viewer/gui/velwidget.h | 43 ++ .../tools/uav_viewer/uav_viewer_simulated.cfg | 8 +- 9 files changed, 697 insertions(+), 462 deletions(-) create mode 100644 src/stable/tools/uav_viewer/gui/datawidget.cpp create mode 100644 src/stable/tools/uav_viewer/gui/datawidget.h create mode 100644 src/stable/tools/uav_viewer/gui/velwidget.cpp create mode 100644 src/stable/tools/uav_viewer/gui/velwidget.h diff --git a/src/stable/tools/uav_viewer/CMakeLists.txt b/src/stable/tools/uav_viewer/CMakeLists.txt index a3fc1fcc3..c3e25f1ad 100644 --- a/src/stable/tools/uav_viewer/CMakeLists.txt +++ b/src/stable/tools/uav_viewer/CMakeLists.txt @@ -20,15 +20,12 @@ if (${QT_COMPILE} AND ${QWT_COMPILE}) ENDMACRO (QT4_WRAP_UI_CUSTOM) SET(qt_SOURCES ./sensors/threadsensors.cpp ./gui/threadgui.cpp ./gui/mainwindow.cpp - ./gui/attitudeindicator.cpp ./gui/speedometer.cpp) + ./gui/attitudeindicator.cpp ./gui/speedometer.cpp gui/velwidget.cpp gui/datawidget.cpp) SET(qt_HEADERS ./sensors/threadsensors.h ./gui/threadgui.h ./gui/mainwindow.h - ./gui/attitudeindicator.h ./gui/speedometer.h) - - SET(qt_FORMS ./gui/mainwindow.ui) + ./gui/attitudeindicator.h ./gui/speedometer.h gui/velwidget.h gui/datawidget.h) QT4_WRAP_CPP(qt_HEADERS_MOC ${qt_HEADERS}) - QT4_WRAP_UI_CUSTOM(qt_FORMS_HEADERS ${qt_FORMS}) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) @@ -50,7 +47,6 @@ if (${QT_COMPILE} AND ${QWT_COMPILE}) add_executable(uav_viewer ${SOURCE_FILES} ${qt_SOURCES} - ${qt_FORMS} ${qt_HEADERS_MOC} ${INTERFACES_CPP_DIR}) diff --git a/src/stable/tools/uav_viewer/gui/datawidget.cpp b/src/stable/tools/uav_viewer/gui/datawidget.cpp new file mode 100644 index 000000000..38959129c --- /dev/null +++ b/src/stable/tools/uav_viewer/gui/datawidget.cpp @@ -0,0 +1,396 @@ +#include "datawidget.h" + +#if QT_VERSION < 0x040000 +typedef QColorGroup Palette; +#else +typedef QPalette Palette; +#endif + +DataWidget::DataWidget(QWidget *parent) : + QWidget(parent) +{ + setWindowTitle("Data"); + this->setFixedSize(640,280); + setUI(); + + pitch=roll=yaw=0.0; +} + +void DataWidget::update() +{ + jderobot::NavdataDataPtr navdata=this->sensors->getNavdata(); + //this->printNavdata(navdata); + jderobot::Pose3DDataPtr pose3DDataPtr = this->sensors->getPose3DData(); + + float qw = pose3DDataPtr->q0; + float qx = pose3DDataPtr->q1; + float qy = pose3DDataPtr->q2; + float qz = pose3DDataPtr->q3; + float yawd=this->rad2deg(quatToYaw(qw, qx, qy, qz)); + float pitchd=this->rad2deg(quatToPitch(qw, qx, qy, qz)); + float rolld=this->rad2deg(quatToRoll(qw, qx, qy, qz)); + drawYawValues(yawd); + drawPitchRollValues(-pitchd,-rolld); + + double altd=pose3DDataPtr->z; + drawAltd(altd); +} + +float DataWidget::rad2deg(float r) +{ + float degree=(r * 180) / M_PI; + return degree; +} + +float DataWidget::quatToRoll(float qw, float qx, float qy, float qz) +{ + + double rotateXa0 = 2.0*(qy*qz + qw*qx); + double rotateXa1 = qw*qw - qx*qx - qy*qy + qz*qz; + float rotateX = 0.0; + if (rotateXa0 != 0.0 && rotateXa1 != 0.0) + rotateX = atan2(rotateXa0, rotateXa1); + + return rotateX; +} + +float DataWidget::quatToPitch(float qw, float qx, float qy, float qz) +{ + + double rotateYa0 = -2.0*(qx*qz - qw*qy); + float rotateY = 0.0; + if( rotateYa0 >= 1.0 ) + rotateY = M_PI/2.0; + else if( rotateYa0 <= -1.0 ) + rotateY = -M_PI/2.0; + else rotateY = asin(rotateYa0); + + return rotateY; +} + +float DataWidget::quatToYaw(float qw, float qx, float qy, float qz) +{ + + double rotateZa0 = 2.0*(qx*qy + qw*qz); + double rotateZa1 = qw*qw + qx*qx - qy*qy - qz*qz; + float rotateZ = 0.0; + if (rotateZa0 != 0.0 && rotateZa1 != 0.0) + rotateZ = atan2(rotateZa0, rotateZa1); + + return rotateZ; +} + +void DataWidget::setUI() +{ + + mainLayout = new QHBoxLayout(); + horizonLayout = new QVBoxLayout(); + horizonData = new QGridLayout(); + compassLayout = new QVBoxLayout(); + compassData = new QGridLayout(); + altLayout = new QVBoxLayout(); + altData = new QGridLayout(); + + yawLabel = new QLabel(); + yawLabel->setObjectName(QString::fromUtf8("yawLabel")); + yawLabel->setGeometry(QRect(260, 130, 41, 21)); + altdLabel = new QLabel(); + altdLabel->setObjectName(QString::fromUtf8("altdLabel")); + altdLabel->setGeometry(QRect(260, 290, 41, 21)); + pitchLabel = new QLabel(); + pitchLabel->setObjectName(QString::fromUtf8("pitchLabel")); + pitchLabel->setGeometry(QRect(70, 250, 41, 21)); + rollLabel = new QLabel(); + rollLabel->setObjectName(QString::fromUtf8("rollLabel")); + rollLabel->setGeometry(QRect(70, 270, 41, 21)); + pitchValue = new QLabel(); + pitchValue->setObjectName(QString::fromUtf8("pitchValue")); + pitchValue->setGeometry(QRect(110, 250, 65, 21)); + pitchValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + rollValue = new QLabel(); + rollValue->setObjectName(QString::fromUtf8("rollValue")); + rollValue->setGeometry(QRect(110, 270, 65, 21)); + rollValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + altdValue = new QLabel(); + altdValue->setObjectName(QString::fromUtf8("altdValue")); + altdValue->setGeometry(QRect(300, 290, 65, 21)); + altdValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + yawValue = new QLabel(); + yawValue->setObjectName(QString::fromUtf8("yawValue")); + yawValue->setGeometry(QRect(300, 130, 65, 21)); + yawValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + yawG = new QLabel(); + yawG->setObjectName(QString::fromUtf8("yawG")); + yawG->setGeometry(QRect(370, 130, 16, 21)); + pitchG = new QLabel(); + pitchG->setObjectName(QString::fromUtf8("pitchG")); + pitchG->setGeometry(QRect(180, 250, 16, 21)); + rollG = new QLabel(); + rollG->setObjectName(QString::fromUtf8("rollG")); + rollG->setGeometry(QRect(180, 270, 16, 21)); + altdM = new QLabel(); + altdM->setObjectName(QString::fromUtf8("altdM")); + altdM->setGeometry(QRect(370, 290, 16, 21)); + + yawLabel->setText(QApplication::translate("DataWidget", "Yaw:", 0, QApplication::UnicodeUTF8)); + altdLabel->setText(QApplication::translate("DataWidget", "Altd.:", 0, QApplication::UnicodeUTF8)); + pitchLabel->setText(QApplication::translate("DataWidget", "Pitch:", 0, QApplication::UnicodeUTF8)); + rollLabel->setText(QApplication::translate("DataWidget", "Roll:", 0, QApplication::UnicodeUTF8)); + pitchValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8)); + rollValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8)); + altdValue->setText(QApplication::translate("DataWidget", "10", 0, QApplication::UnicodeUTF8)); + yawValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8)); + yawG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8)); + pitchG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8)); + rollG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8)); + altdM->setText(QApplication::translate("DataWidget", "m", 0, QApplication::UnicodeUTF8)); + + horizonData->addWidget(pitchLabel,0,0,Qt::AlignCenter); + horizonData->addWidget(pitchValue,0,1,Qt::AlignCenter); + horizonData->addWidget(pitchG,0,2,Qt::AlignCenter); + horizonData->addWidget(rollLabel,1,0,Qt::AlignCenter); + horizonData->addWidget(rollValue,1,1,Qt::AlignCenter); + horizonData->addWidget(rollG,1,2,Qt::AlignCenter); + + compassData->addWidget(yawLabel,0,0,Qt::AlignCenter); + compassData->addWidget(yawValue,0,1,Qt::AlignCenter); + + altData->addWidget(altdLabel,0,0,Qt::AlignCenter); + altData->addWidget(altdValue,0,1,Qt::AlignCenter); + + horizon=createDial(0); + horizon->setGeometry(QRect(750,80,200,200)); + horizon->setMinimumSize(200,200); + horizonLayout->addWidget(horizon); + horizonLayout->addLayout(horizonData); + + compass=createCompass(1); + compass->setGeometry(QRect(0,0,200,200)); + compass->setMinimumSize(200,200); + compass->setReadOnly(true); + compassLayout->addWidget(compass); + compassLayout->addLayout(compassData); + + altd=createDial(2); + altd->setGeometry(QRect(970,200,115,135)); + altd->setMinimumSize(115,135); + altLayout->addWidget(altd); + altLayout->addLayout(altData); + + mainLayout->addLayout(horizonLayout); + mainLayout->addLayout(compassLayout); + mainLayout->addLayout(altLayout); + setLayout(mainLayout); + +} + +void DataWidget::setSensors(Sensors* sensors){ + this->sensors=sensors; +} + + +QwtCompass *DataWidget::createCompass(int pos) +{ + int c; + + Palette colorGroup; + for ( c = 0; c < Palette::NColorRoles; c++ ) + colorGroup.setColor((Palette::ColorRole)c, QColor()); + + #if QT_VERSION < 0x040000 + colorGroup.setColor(Palette::Base, backgroundColor().light(120)); + #else + colorGroup.setColor(Palette::Base, + palette().color(backgroundRole()).light(120)); + #endif + colorGroup.setColor(Palette::Foreground, + colorGroup.color(Palette::Base)); + + QwtCompass *compass = new QwtCompass(this); + compass->setLineWidth(4); + compass->setFrameShadow( + pos <= 2 ? QwtCompass::Sunken : QwtCompass::Raised); + + switch(pos) + { + case 0: + { + /* + A windrose, with a scale indicating the main directions only + */ + QMap map; + map.insert(0.0, "N"); + map.insert(90.0, "E"); + map.insert(180.0, "S"); + map.insert(270.0, "W"); + + compass->setLabelMap(map); + + QwtSimpleCompassRose *rose = new QwtSimpleCompassRose(4, 1); + compass->setRose(rose); + + compass->setNeedle( + new QwtCompassWindArrow(QwtCompassWindArrow::Style2)); + compass->setValue(60.0); + break; + } + case 1: + { + /* + A compass showing another needle + */ + QMap map; + map.insert(0.0, ""); + map.insert(90.0, ""); + map.insert(180.0, ""); + map.insert(270.0, ""); + + compass->setLabelMap(map); + + compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel); + compass->setScaleTicks(0, 0, 3); + + compass->setNeedle(new QwtCompassMagnetNeedle( + QwtCompassMagnetNeedle::TriangleStyle, Qt::white, Qt::red)); + compass->setValue(220.0); + break; + } + } + + QPalette newPalette = compass->palette(); + for ( c = 0; c < Palette::NColorRoles; c++ ) + { + if ( colorGroup.color((Palette::ColorRole)c).isValid() ) + { + for ( int cg = 0; cg < QPalette::NColorGroups; cg++ ) + { + newPalette.setColor( + (QPalette::ColorGroup)cg, + (Palette::ColorRole)c, + colorGroup.color((Palette::ColorRole)c)); + } + } + } + + for ( int i = 0; i < QPalette::NColorGroups; i++ ) + { + QPalette::ColorGroup cg = (QPalette::ColorGroup)i; + + const QColor light = + newPalette.color(cg, Palette::Base).light(170); + const QColor dark = newPalette.color(cg, Palette::Base).dark(170); + const QColor mid = compass->frameShadow() == QwtDial::Raised + ? newPalette.color(cg, Palette::Base).dark(110) + : newPalette.color(cg, Palette::Base).light(110); + + newPalette.setColor(cg, Palette::Dark, dark); + newPalette.setColor(cg, Palette::Mid, mid); + newPalette.setColor(cg, Palette::Light, light); + } + compass->setPalette(newPalette); + + return compass; +} + +QwtDial *DataWidget::createDial(int pos) +{ + QwtDial *dial = NULL; + switch(pos) + { + case 0: + { + d_ai = new AttitudeIndicator(this); + dial = d_ai; + break; + } + case 1: + { + d_speedo = new SpeedoMeter(this); + d_speedo->setRange(0.0,8.0); + d_speedo->setLabel("m/s"); + d_speedo->setOrigin(180); + d_speedo->setScaleArc(0.0,270.0); + d_speedo->setScale(-1, 2, 1.0); + dial = d_speedo; + break; + } + case 2: + { + d_speedo = new SpeedoMeter(this); + d_speedo->setRange(0.0,10.0); + d_speedo->setLabel("m"); + d_speedo->setOrigin(-90); + d_speedo->setScaleArc(0.0,360.0); + d_speedo->setScale(-1, 2, 1); + dial = d_speedo; + break; + } + + } + + if ( dial ) + { + dial->setReadOnly(true); + dial->scaleDraw()->setPenWidth(3); + dial->setLineWidth(4); + dial->setFrameShadow(QwtDial::Sunken); + } + return dial; +} + + +void DataWidget::drawYawValues(float degress) +{ + //Rot Z + //-180,180 + //- right,+ left + //Compass 360º + QString value=QString::number(degress,'f',2); + yawValue->setText(QString(value)); + compass->setValue(degress); +} + +void DataWidget::drawAltd(float meters) +{ + int cent=0; + float result=0.0; + if(meters>=10 && meters<100){ + cent=(int)meters/10; + result=meters-(cent*10); + altd->setValue(result); + }else if((meters>=100 && meters<1000)){ + cent=(int)meters/100; + result=meters-(cent*100); + altd->setValue(result); + }else{ + altd->setValue(meters); + } + + + QString value=QString::number(meters,'f',2); + altdValue->setText(value); +} + +void DataWidget::drawPitchRollValues(float pitch,float roll) +{ + float resultP=0.0; + if(pitch>0 && pitch<=90){ + resultP=pitch/90; + resultP=-resultP; + }else if(pitch<0 && pitch>=-90){ + resultP=pitch/-90; + }else{ + resultP=0.0; + } + + //rotY + d_ai->setGradient(resultP); + //rotX + d_ai->setAngle(roll); + QString pString=QString::number(pitch,'f',2); + QString rString=QString::number(roll,'f',2); + + pitchValue->setText(pString); + rollValue->setText(rString); + +} diff --git a/src/stable/tools/uav_viewer/gui/datawidget.h b/src/stable/tools/uav_viewer/gui/datawidget.h new file mode 100644 index 000000000..27a0043a1 --- /dev/null +++ b/src/stable/tools/uav_viewer/gui/datawidget.h @@ -0,0 +1,81 @@ +#ifndef DATAWIDGET_H +#define DATAWIDGET_H + +#include +#include +#include +#include "speedometer.h" +#include "../sensors/sensors.h" +#include "attitudeindicator.h" +#include +#include +#include +#include + + +class DataWidget: public QWidget +{ +public: + DataWidget(QWidget *parent = 0); + void update(); + void setUI(); + QwtCompass *createCompass(int pos); + QwtDial *createDial(int pos); + void setSensors(Sensors* sensors); + + void drawYawValues(float degress); + void drawAltd(float meters); + void drawPitchRollValues(float pitch,float roll); + + static float quatToRoll(float, float, float, float); + static float quatToPitch(float, float, float, float); + static float quatToYaw(float, float, float, float); + float rad2deg(float r); + + + +protected: + + QMutex mutex; + +private: + QHBoxLayout *mainLayout; + QVBoxLayout *horizonLayout; + QGridLayout *horizonData; + QVBoxLayout *compassLayout; + QGridLayout *compassData; + QVBoxLayout *altLayout; + QGridLayout *altData; + + QLabel *yawLabel; + QLabel *altdLabel; + QLabel *pitchLabel; + QLabel *rollLabel; + QLabel *pitchValue; + QLabel *rollValue; + QLabel *altdValue; + QLabel *yawValue; + QLabel *yawG; + QLabel *pitchG; + QLabel *rollG; + QLabel *altdM; + + + QwtCompass *compass; + QwtDial *altd; + QwtDial *horizon; + + + QwtDial *velLinZ; + QwtDial *velLinY; + QwtDial *velLinX; + SpeedoMeter *d_speedo; + Sensors *sensors; + + AttitudeIndicator *d_ai; + + float pitch, roll, yaw; + +}; + +#endif // DATAWIDGET_H diff --git a/src/stable/tools/uav_viewer/gui/mainwindow.cpp b/src/stable/tools/uav_viewer/gui/mainwindow.cpp index 4bd7d8765..73325f995 100644 --- a/src/stable/tools/uav_viewer/gui/mainwindow.cpp +++ b/src/stable/tools/uav_viewer/gui/mainwindow.cpp @@ -20,33 +20,14 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); ui->battery->setValue(60.0); - vx=vy=vz=pitch=roll=yaw=0.0; - linx=liny=linz=0.0; - - compass=createCompass(1); - compass->setGeometry(QRect(970,50,120,120)); - - compass->setReadOnly(true); - //compass->setValue(200.0); - - altd=createDial(2); - - altd->setGeometry(QRect(970,200,115,135)); - + vel = new VelWidget(); + vel->show(); - velLinZ = createDial(1); - velLinZ->setGeometry(QRect(1050,400,150,150)); + dataw = new DataWidget(); + dataw->show(); - - velLinY = createDial(1); - velLinY->setGeometry(QRect(900,400,150,150)); - - velLinX = createDial(1); - velLinX->setGeometry(QRect(750,400,150,150)); - - - horizon=createDial(0); - horizon->setGeometry(QRect(750,80,200,200)); + linx=liny=linz=0.0; + roll=pitch=yaw=0.0; ui->tabWidget->setCurrentIndex(0); @@ -105,14 +86,6 @@ void MainWindow::initButtons(){ MainWindow::~MainWindow() { delete sensors; - delete compass; - delete altd; - delete velLinY; - delete velLinZ; - delete velLinX; - delete horizon; - delete d_ai; - delete d_speedo; delete ui; } @@ -149,6 +122,11 @@ void MainWindow::updateGUI_recieved() y=(IMAGE_ROWS_MAX+40)/2-(image.rows/2); } + //actualizar velocidades + vel->update(); + + //actualizar datos nav + dataw->update(); QSize size(image.cols,image.rows); ui->imageLLabel->move(x,y); @@ -157,26 +135,9 @@ void MainWindow::updateGUI_recieved() ui->imageLLabel->setHidden(false); ui->imageLLabel->setPixmap(QPixmap::fromImage(imageQt)); - jderobot::NavdataDataPtr navdata=this->sensors->getNavdata(); - //this->printNavdata(navdata); - jderobot::Pose3DDataPtr pose3DDataPtr = this->sensors->getPose3DData(); - int batteryPer=navdata->batteryPercent; - ui->battery->setValue(batteryPer); - float qw = pose3DDataPtr->q0; - float qx = pose3DDataPtr->q1; - float qy = pose3DDataPtr->q2; - float qz = pose3DDataPtr->q3; - float yawd=this->rad2deg(quatToYaw(qw, qx, qy, qz)); - float pitchd=this->rad2deg(quatToPitch(qw, qx, qy, qz)); - float rolld=this->rad2deg(quatToRoll(qw, qx, qy, qz)); - drawYawValues(yawd); - drawPitchRollValues(-pitchd,-rolld); - - double altd=pose3DDataPtr->z; - drawAltd(altd); - - drawVelocitiesValues(navdata->vx,navdata->vy,navdata->vz); - + jderobot::NavdataDataPtr navdata=this->sensors->getNavdata(); + int batteryPer=navdata->batteryPercent; + ui->battery->setValue(batteryPer); this->setDroneStatus(navdata->state); } @@ -192,7 +153,7 @@ void MainWindow::printNavdata(jderobot::NavdataDataPtr data) std::cout << "RotY:\t"<< data->rotY << std::endl; std::cout << "RotZ:\t"<< data->rotZ << "\n" << std::endl; - std::cout << "Vx:\t"<< data->vx <vx <vy << std::endl; std::cout << "Vz:\t"<< data->vz << "\n" << std::endl; std::cout << "Ax:\t"<< data->ax <sensors->sendVelocitiesToUAV(linx,liny,linz,roll,pitch,yaw); } -void MainWindow::drawYawValues(float degress) -{ - //Rot Z - //-180,180 - //- right,+ left - //Compass 360º - QString value=QString::number(degress,'f',2); - ui->yawValue->setText(QString(value)); - compass->setValue(degress); -} - -void MainWindow::drawAltd(float meters) -{ - int cent=0; - float result=0.0; - if(meters>=10 && meters<100){ - cent=(int)meters/10; - result=meters-(cent*10); - altd->setValue(result); - }else if((meters>=100 && meters<1000)){ - cent=(int)meters/100; - result=meters-(cent*100); - altd->setValue(result); - }else{ - altd->setValue(meters); - } - - - QString value=QString::number(meters,'f',2); - ui->altdValue->setText(value); -} - -void MainWindow::drawPitchRollValues(float pitch,float roll) -{ - float resultP=0.0; - if(pitch>0 && pitch<=90){ - resultP=pitch/90; - resultP=-resultP; - }else if(pitch<0 && pitch>=-90){ - resultP=pitch/-90; - }else{ - resultP=0.0; - } - - //rotY - d_ai->setGradient(resultP); - //rotX - d_ai->setAngle(roll); - QString pString=QString::number(pitch,'f',2); - QString rString=QString::number(roll,'f',2); - - ui->pitchValue->setText(pString); - ui->rollValue->setText(rString); - -} - -void MainWindow::drawVelocitiesValues(float vlx,float vly,float vlz) -{ - //mm/sec to m/s - float result=0.0; - if(vlx<0.0){ - ui->velXLabel->setStyleSheet("QLabel {background-color: red}"); - }else{ - ui->velXLabel->setStyleSheet("QLabel {background-color: green}"); - } - vlx=std::abs(vlx); - vlx=vlx/1000.0; - result=(0.6*vx)+((1-0.6)*vlx); - velLinX->setValue(result); - vx=vlx; - - if(vly<0.0){ - ui->velYLabel->setStyleSheet("QLabel {background-color: red}"); - }else{ - ui->velYLabel->setStyleSheet("QLabel {background-color: green}"); - } - vly=std::abs(vly); - vly=vly/1000.0; - result=(0.6*vy)+((1-0.6)*vly); - velLinY->setValue(result); - vy=vly; - - if(vlz<0.0){ - ui->velZLabel->setStyleSheet("QLabel {background-color: red}"); - }else{ - ui->velZLabel->setStyleSheet("QLabel {background-color: green}"); - } - vlz=std::abs(vlz); - vlz=vlz/1000.0; - result=(0.6*vz)+((1-0.6)*vlz); - velLinZ->setValue(result); - vz=vlz; -} - void MainWindow::setSensors(Sensors* sensors){ this->sensors=sensors; - -} - -QwtCompass *MainWindow::createCompass(int pos) -{ - int c; - - Palette colorGroup; - for ( c = 0; c < Palette::NColorRoles; c++ ) - colorGroup.setColor((Palette::ColorRole)c, QColor()); - - #if QT_VERSION < 0x040000 - colorGroup.setColor(Palette::Base, backgroundColor().light(120)); - #else - colorGroup.setColor(Palette::Base, - palette().color(backgroundRole()).light(120)); - #endif - colorGroup.setColor(Palette::Foreground, - colorGroup.color(Palette::Base)); - - QwtCompass *compass = new QwtCompass(this); - compass->setLineWidth(4); - compass->setFrameShadow( - pos <= 2 ? QwtCompass::Sunken : QwtCompass::Raised); - - switch(pos) - { - case 0: - { - /* - A windrose, with a scale indicating the main directions only - */ - QMap map; - map.insert(0.0, "N"); - map.insert(90.0, "E"); - map.insert(180.0, "S"); - map.insert(270.0, "W"); - - compass->setLabelMap(map); - - QwtSimpleCompassRose *rose = new QwtSimpleCompassRose(4, 1); - compass->setRose(rose); - - compass->setNeedle( - new QwtCompassWindArrow(QwtCompassWindArrow::Style2)); - compass->setValue(60.0); - break; - } - case 1: - { - /* - A compass showing another needle - */ - QMap map; - map.insert(0.0, ""); - map.insert(90.0, ""); - map.insert(180.0, ""); - map.insert(270.0, ""); - - compass->setLabelMap(map); - - compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel); - compass->setScaleTicks(0, 0, 3); - - compass->setNeedle(new QwtCompassMagnetNeedle( - QwtCompassMagnetNeedle::TriangleStyle, Qt::white, Qt::red)); - compass->setValue(220.0); - break; - } - } - - QPalette newPalette = compass->palette(); - for ( c = 0; c < Palette::NColorRoles; c++ ) - { - if ( colorGroup.color((Palette::ColorRole)c).isValid() ) - { - for ( int cg = 0; cg < QPalette::NColorGroups; cg++ ) - { - newPalette.setColor( - (QPalette::ColorGroup)cg, - (Palette::ColorRole)c, - colorGroup.color((Palette::ColorRole)c)); - } - } - } - - for ( int i = 0; i < QPalette::NColorGroups; i++ ) - { - QPalette::ColorGroup cg = (QPalette::ColorGroup)i; - - const QColor light = - newPalette.color(cg, Palette::Base).light(170); - const QColor dark = newPalette.color(cg, Palette::Base).dark(170); - const QColor mid = compass->frameShadow() == QwtDial::Raised - ? newPalette.color(cg, Palette::Base).dark(110) - : newPalette.color(cg, Palette::Base).light(110); - - newPalette.setColor(cg, Palette::Dark, dark); - newPalette.setColor(cg, Palette::Mid, mid); - newPalette.setColor(cg, Palette::Light, light); - } - compass->setPalette(newPalette); - - return compass; -} - -QwtDial *MainWindow::createDial(int pos) -{ - QwtDial *dial = NULL; - switch(pos) - { - case 0: - { - d_ai = new AttitudeIndicator(this); - dial = d_ai; - break; - } - case 1: - { - d_speedo = new SpeedoMeter(this); - d_speedo->setRange(0.0,8.0); - d_speedo->setLabel("m/s"); - d_speedo->setOrigin(180); - d_speedo->setScaleArc(0.0,270.0); - d_speedo->setScale(-1, 2, 1.0); - dial = d_speedo; - break; - } - case 2: - { - d_speedo = new SpeedoMeter(this); - d_speedo->setRange(0.0,10.0); - d_speedo->setLabel("m"); - d_speedo->setOrigin(-90); - d_speedo->setScaleArc(0.0,360.0); - d_speedo->setScale(-1, 2, 1); - dial = d_speedo; - break; - } - - } - - if ( dial ) - { - dial->setReadOnly(true); - dial->scaleDraw()->setPenWidth(3); - dial->setLineWidth(4); - dial->setFrameShadow(QwtDial::Sunken); - } - return dial; + vel->setSensors(this->sensors); + dataw->setSensors(this->sensors); } void MainWindow::on_takeoff_button_clicked() @@ -705,23 +424,14 @@ void MainWindow::keyReleaseEvent(QKeyEvent *k ) void MainWindow::on_tabWidget_currentChanged(int index) { - if(index==0){ - compass->show(); - altd->show(); - velLinX->show(); - velLinY->show(); - velLinZ->show(); - horizon->show(); +/* if(index==0){ + }else{ - compass->hide(); - altd->hide(); - velLinX->hide(); - velLinY->hide(); - velLinZ->hide(); - horizon->hide(); - } + } +*/ } + void MainWindow::setDroneStatus(int state){ switch(state){ case 1: @@ -757,46 +467,6 @@ void MainWindow::setDroneStatus(int state){ } -float MainWindow::rad2deg(float r) -{ - float degree=(r * 180) / M_PI; - return degree; -} -float MainWindow::quatToRoll(float qw, float qx, float qy, float qz) -{ - double rotateXa0 = 2.0*(qy*qz + qw*qx); - double rotateXa1 = qw*qw - qx*qx - qy*qy + qz*qz; - float rotateX = 0.0; - if (rotateXa0 != 0.0 && rotateXa1 != 0.0) - rotateX = atan2(rotateXa0, rotateXa1); - return rotateX; -} - -float MainWindow::quatToPitch(float qw, float qx, float qy, float qz) -{ - - double rotateYa0 = -2.0*(qx*qz - qw*qy); - float rotateY = 0.0; - if( rotateYa0 >= 1.0 ) - rotateY = M_PI/2.0; - else if( rotateYa0 <= -1.0 ) - rotateY = -M_PI/2.0; - else rotateY = asin(rotateYa0); - - return rotateY; -} - -float MainWindow::quatToYaw(float qw, float qx, float qy, float qz) -{ - - double rotateZa0 = 2.0*(qx*qy + qw*qz); - double rotateZa1 = qw*qw + qx*qx - qy*qy - qz*qz; - float rotateZ = 0.0; - if (rotateZa0 != 0.0 && rotateZa1 != 0.0) - rotateZ = atan2(rotateZa0, rotateZa1); - - return rotateZ; -} diff --git a/src/stable/tools/uav_viewer/gui/mainwindow.h b/src/stable/tools/uav_viewer/gui/mainwindow.h index 42e8184df..8f62b5eab 100644 --- a/src/stable/tools/uav_viewer/gui/mainwindow.h +++ b/src/stable/tools/uav_viewer/gui/mainwindow.h @@ -9,6 +9,8 @@ #include "attitudeindicator.h" #include "speedometer.h" #include "../sensors/sensors.h" +#include "velwidget.h" +#include "datawidget.h" namespace Ui { @@ -80,32 +82,17 @@ class MainWindow : public QMainWindow private: void sendVelocitiesToUAV(); - void drawYawValues(float degress); - void drawAltd(float meters); - void drawPitchRollValues(float pitch,float roll); - static float quatToRoll(float, float, float, float); - static float quatToPitch(float, float, float, float); - static float quatToYaw(float, float, float, float); - float rad2deg(float r); + void initButtons(); - void drawVelocitiesValues(float vx,float vy,float vz); void setDroneStatus(int state); void printNavdata(jderobot::NavdataDataPtr data); - float vx,vy,vz,pitch,roll,yaw; float linx,liny,linz; + float roll, pitch, yaw; float max_x, max_y, max_z, max_yaw; - QwtCompass *createCompass(int pos); - QwtDial *createDial(int pos); Ui::MainWindow *ui; - SpeedoMeter *d_speedo; - AttitudeIndicator *d_ai; - QwtDial *velLinZ; - QwtDial *velLinY; - QwtDial *velLinX; - QwtCompass *compass; - QwtDial *altd; - QwtDial *horizon; Sensors* sensors; + VelWidget *vel; + DataWidget *dataw; }; #endif // MAINWINDOW_H diff --git a/src/stable/tools/uav_viewer/gui/ui_mainwindow.h b/src/stable/tools/uav_viewer/gui/ui_mainwindow.h index 5893f2811..7950ec3c8 100644 --- a/src/stable/tools/uav_viewer/gui/ui_mainwindow.h +++ b/src/stable/tools/uav_viewer/gui/ui_mainwindow.h @@ -74,81 +74,31 @@ class Ui_MainWindow { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); - MainWindow->resize(1240, 620); - MainWindow->setMinimumSize(QSize(1240, 620)); - MainWindow->setMaximumSize(QSize(1240, 620)); + MainWindow->resize(900, 620); + MainWindow->setMinimumSize(QSize(650, 620)); + MainWindow->setMaximumSize(QSize(650, 620)); + centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); + tabWidget = new QTabWidget(centralWidget); tabWidget->setObjectName(QString::fromUtf8("tabWidget")); - tabWidget->setGeometry(QRect(10, 0, 1221, 611)); + tabWidget->setGeometry(QRect(10, 0, 630, 611)); + view_tab = new QWidget(); view_tab->setObjectName(QString::fromUtf8("view_tab")); - vel_groupbox = new QGroupBox(view_tab); - vel_groupbox->setObjectName(QString::fromUtf8("vel_groupbox")); - vel_groupbox->setGeometry(QRect(720, 330, 521, 221)); - velXLabel = new QLabel(vel_groupbox); - velXLabel->setObjectName(QString::fromUtf8("velXLabel")); - velXLabel->setGeometry(QRect(60, 190, 51, 21)); - velYLabel = new QLabel(vel_groupbox); - velYLabel->setObjectName(QString::fromUtf8("velYLabel")); - velYLabel->setGeometry(QRect(220, 190, 51, 21)); - velZLabel = new QLabel(vel_groupbox); - velZLabel->setObjectName(QString::fromUtf8("velZLabel")); - velZLabel->setGeometry(QRect(370, 190, 51, 21)); - data_groupbox = new QGroupBox(view_tab); - data_groupbox->setObjectName(QString::fromUtf8("data_groupbox")); - data_groupbox->setGeometry(QRect(710, 10, 521, 311)); - battery = new QwtThermo(data_groupbox); + + battery = new QwtThermo(view_tab); battery->setObjectName(QString::fromUtf8("battery")); - battery->setGeometry(QRect(430, 30, 56, 241)); + battery->setGeometry(QRect(530, 30, 56, 241)); battery->setMaxValue(100); - batteryLabel = new QLabel(data_groupbox); + batteryLabel = new QLabel(view_tab); batteryLabel->setObjectName(QString::fromUtf8("batteryLabel")); - batteryLabel->setGeometry(QRect(440, 290, 51, 21)); - yawLabel = new QLabel(data_groupbox); - yawLabel->setObjectName(QString::fromUtf8("yawLabel")); - yawLabel->setGeometry(QRect(260, 130, 41, 21)); - altdLabel = new QLabel(data_groupbox); - altdLabel->setObjectName(QString::fromUtf8("altdLabel")); - altdLabel->setGeometry(QRect(260, 290, 41, 21)); - pitchLabel = new QLabel(data_groupbox); - pitchLabel->setObjectName(QString::fromUtf8("pitchLabel")); - pitchLabel->setGeometry(QRect(70, 250, 41, 21)); - rollLabel = new QLabel(data_groupbox); - rollLabel->setObjectName(QString::fromUtf8("rollLabel")); - rollLabel->setGeometry(QRect(70, 270, 41, 21)); - pitchValue = new QLabel(data_groupbox); - pitchValue->setObjectName(QString::fromUtf8("pitchValue")); - pitchValue->setGeometry(QRect(110, 250, 65, 21)); - pitchValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - rollValue = new QLabel(data_groupbox); - rollValue->setObjectName(QString::fromUtf8("rollValue")); - rollValue->setGeometry(QRect(110, 270, 65, 21)); - rollValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - altdValue = new QLabel(data_groupbox); - altdValue->setObjectName(QString::fromUtf8("altdValue")); - altdValue->setGeometry(QRect(300, 290, 65, 21)); - altdValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - yawValue = new QLabel(data_groupbox); - yawValue->setObjectName(QString::fromUtf8("yawValue")); - yawValue->setGeometry(QRect(300, 130, 65, 21)); - yawValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - yawG = new QLabel(data_groupbox); - yawG->setObjectName(QString::fromUtf8("yawG")); - yawG->setGeometry(QRect(370, 130, 16, 21)); - pitchG = new QLabel(data_groupbox); - pitchG->setObjectName(QString::fromUtf8("pitchG")); - pitchG->setGeometry(QRect(180, 250, 16, 21)); - rollG = new QLabel(data_groupbox); - rollG->setObjectName(QString::fromUtf8("rollG")); - rollG->setGeometry(QRect(180, 270, 16, 21)); - altdM = new QLabel(data_groupbox); - altdM->setObjectName(QString::fromUtf8("altdM")); - altdM->setGeometry(QRect(370, 290, 16, 21)); + batteryLabel->setGeometry(QRect(540, 290, 51, 21)); + imageLabel = new QLabel(view_tab); imageLabel->setObjectName(QString::fromUtf8("imageLabel")); - imageLabel->setGeometry(QRect(120, 100, 320, 240)); + imageLabel->setGeometry(QRect(20, 0, 320, 240)); imageLabel->setMinimumSize(QSize(320, 240)); imageLabel->setMaximumSize(QSize(320, 240)); controlBox = new QGroupBox(view_tab); @@ -230,9 +180,11 @@ class Ui_MainWindow imageLLabel->setObjectName(QString::fromUtf8("imageLLabel")); imageLLabel->setGeometry(QRect(20, 40, 640, 320)); tabWidget->addTab(view_tab, QString()); + gps_tab = new QWidget(); gps_tab->setObjectName(QString::fromUtf8("gps_tab")); tabWidget->addTab(gps_tab, QString()); + MainWindow->setCentralWidget(centralWidget); retranslateUi(MainWindow); @@ -246,24 +198,7 @@ class Ui_MainWindow void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "uav_viewer", 0, QApplication::UnicodeUTF8)); - vel_groupbox->setTitle(QApplication::translate("MainWindow", "Velocities", 0, QApplication::UnicodeUTF8)); - velXLabel->setText(QApplication::translate("MainWindow", "Lineal X", 0, QApplication::UnicodeUTF8)); - velYLabel->setText(QApplication::translate("MainWindow", "Lineal Y", 0, QApplication::UnicodeUTF8)); - velZLabel->setText(QApplication::translate("MainWindow", "Lineal Z", 0, QApplication::UnicodeUTF8)); - data_groupbox->setTitle(QApplication::translate("MainWindow", "Data", 0, QApplication::UnicodeUTF8)); batteryLabel->setText(QApplication::translate("MainWindow", "Battery", 0, QApplication::UnicodeUTF8)); - yawLabel->setText(QApplication::translate("MainWindow", "Yaw:", 0, QApplication::UnicodeUTF8)); - altdLabel->setText(QApplication::translate("MainWindow", "Altd.:", 0, QApplication::UnicodeUTF8)); - pitchLabel->setText(QApplication::translate("MainWindow", "Pitch:", 0, QApplication::UnicodeUTF8)); - rollLabel->setText(QApplication::translate("MainWindow", "Roll:", 0, QApplication::UnicodeUTF8)); - pitchValue->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8)); - rollValue->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8)); - altdValue->setText(QApplication::translate("MainWindow", "10", 0, QApplication::UnicodeUTF8)); - yawValue->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8)); - yawG->setText(QApplication::translate("MainWindow", "\302\272", 0, QApplication::UnicodeUTF8)); - pitchG->setText(QApplication::translate("MainWindow", "\302\272", 0, QApplication::UnicodeUTF8)); - rollG->setText(QApplication::translate("MainWindow", "\302\272", 0, QApplication::UnicodeUTF8)); - altdM->setText(QApplication::translate("MainWindow", "m", 0, QApplication::UnicodeUTF8)); imageLabel->setText(QString()); controlBox->setTitle(QApplication::translate("MainWindow", "Control", 0, QApplication::UnicodeUTF8)); takeoff_button->setText(QApplication::translate("MainWindow", "take off", 0, QApplication::UnicodeUTF8)); diff --git a/src/stable/tools/uav_viewer/gui/velwidget.cpp b/src/stable/tools/uav_viewer/gui/velwidget.cpp new file mode 100644 index 000000000..5a7adc40f --- /dev/null +++ b/src/stable/tools/uav_viewer/gui/velwidget.cpp @@ -0,0 +1,127 @@ +#include "velwidget.h" +#include + +VelWidget::VelWidget(QWidget *parent) : + QWidget(parent) +{ + + //setAutoFillBackground(true); + + setFixedSize(530, 230); + + vx = vy = vz = 0.0; + + setWindowTitle("Velocities"); + setUI(); +} + +void VelWidget::setSensors(Sensors* sensors){ + this->sensors=sensors; +} + +void VelWidget::update() +{ + jderobot::NavdataDataPtr navdata = this->sensors->getNavdata(); + drawVelocitiesValues(navdata->vx,navdata->vy,navdata->vz); +} + +void VelWidget::setUI() +{ + + mainLayout = new QGridLayout(); + + velXLabel = new QLabel(); + velXLabel->setObjectName(QString::fromUtf8("velXLabel")); + velXLabel->setGeometry(QRect(10, 10, 51, 21)); + velYLabel = new QLabel(); + velYLabel->setObjectName(QString::fromUtf8("velYLabel")); + velYLabel->setGeometry(QRect(220, 190, 51, 21)); + velZLabel = new QLabel(); + velZLabel->setObjectName(QString::fromUtf8("velZLabel")); + velZLabel->setGeometry(QRect(370, 190, 51, 21)); + + velXLabel->setText(QApplication::translate("VelWidget", "Lineal X", 0, QApplication::UnicodeUTF8)); + velYLabel->setText(QApplication::translate("VelWidget", "Lineal Y", 0, QApplication::UnicodeUTF8)); + velZLabel->setText(QApplication::translate("VelWidget", "Lineal Z", 0, QApplication::UnicodeUTF8)); + + velLinZ = createDial(1); + velLinZ->setGeometry(QRect(1050,400,150,150)); + + velLinY = createDial(1); + velLinY->setGeometry(QRect(900,400,150,150)); + + velLinX = createDial(1); + velLinX->setGeometry(QRect(750,400,150,150)); + + mainLayout->addWidget(velLinX,0,0,Qt::AlignCenter); + mainLayout->addWidget(velXLabel,1,0,Qt::AlignCenter); + mainLayout->addWidget(velLinY,0,1,Qt::AlignCenter); + mainLayout->addWidget(velYLabel,1,1,Qt::AlignCenter); + mainLayout->addWidget(velLinZ,0,2,Qt::AlignCenter); + mainLayout->addWidget(velZLabel,1,2,Qt::AlignCenter); + + + setLayout(mainLayout); + + +} + +QwtDial *VelWidget::createDial(int pos) +{ + QwtDial *dial = NULL; + + d_speedo = new SpeedoMeter(this); + d_speedo->setRange(0.0,8.0); + d_speedo->setLabel("m/s"); + d_speedo->setOrigin(180); + d_speedo->setScaleArc(0.0,270.0); + d_speedo->setScale(-1, 2, 1.0); + dial = d_speedo; + + if ( dial ) + { + dial->setReadOnly(true); + dial->scaleDraw()->setPenWidth(3); + dial->setLineWidth(4); + dial->setFrameShadow(QwtDial::Sunken); + } + return dial; +} + +void VelWidget::drawVelocitiesValues(float vlx,float vly,float vlz) +{ + //mm/sec to m/s + float result=0.0; + /* if(vlx<0.0){ + velXLabel->setStyleSheet("QLabel {background-color: red}"); + }else{ + velXLabel->setStyleSheet("QLabel {background-color: green}"); + }*/ + vlx=std::abs(vlx); + vlx=vlx/1000.0; + result=(0.6*vx)+((1-0.6)*vlx); + velLinX->setValue(result); + vx=vlx; + + /*if(vly<0.0){ + velYLabel->setStyleSheet("QLabel {background-color: red}"); + }else{ + velYLabel->setStyleSheet("QLabel {background-color: green}"); + }*/ + vly=std::abs(vly); + vly=vly/1000.0; + result=(0.6*vy)+((1-0.6)*vly); + velLinY->setValue(result); + vy=vly; + + /*if(vlz<0.0){ + velZLabel->setStyleSheet("QLabel {background-color: red}"); + }else{ + velZLabel->setStyleSheet("QLabel {background-color: green}"); + }*/ + vlz=std::abs(vlz); + vlz=vlz/1000.0; + result=(0.6*vz)+((1-0.6)*vlz); + velLinZ->setValue(result); + vz=vlz; +} diff --git a/src/stable/tools/uav_viewer/gui/velwidget.h b/src/stable/tools/uav_viewer/gui/velwidget.h new file mode 100644 index 000000000..18a846c41 --- /dev/null +++ b/src/stable/tools/uav_viewer/gui/velwidget.h @@ -0,0 +1,43 @@ +#ifndef VELWIDGET_H +#define VELWIDGET_H + +#include +#include +#include +#include "speedometer.h" +#include "../sensors/sensors.h" + + +class VelWidget: public QWidget +{ +public: + VelWidget(QWidget *parent = 0); + void update(); + void setUI(); + QwtDial *createDial(int pos); + void drawVelocitiesValues(float vlx,float vly,float vlz); + void setSensors(Sensors* sensors); + + + +protected: + + QMutex mutex; + +private: + QGridLayout *mainLayout; + QLabel *velXLabel; + QLabel *velYLabel; + QLabel *velZLabel; + + QwtDial *velLinZ; + QwtDial *velLinY; + QwtDial *velLinX; + SpeedoMeter *d_speedo; + Sensors *sensors; + + float vx,vy,vz; + +}; + +#endif // VELWIDGET_H diff --git a/src/stable/tools/uav_viewer/uav_viewer_simulated.cfg b/src/stable/tools/uav_viewer/uav_viewer_simulated.cfg index e55c8c614..2b3f81bce 100644 --- a/src/stable/tools/uav_viewer/uav_viewer_simulated.cfg +++ b/src/stable/tools/uav_viewer/uav_viewer_simulated.cfg @@ -3,8 +3,8 @@ UAVViewer.Pose3D.Proxy=Pose3D:default -h 0.0.0.0 -p 9000 UAVViewer.CMDVel.Proxy=CMDVel:default -h 0.0.0.0 -p 9000 UAVViewer.Navdata.Proxy=Navdata:default -h 0.0.0.0 -p 9000 UAVViewer.Extra.Proxy=Extra:default -h 0.0.0.0 -p 9000 -UAVViewer.Xmax=1 -UAVViewer.Ymax=1 -UAVViewer.Zmax=1 -UAVViewer.Yawmax=1 +UAVViewer.Xmax=10 +UAVViewer.Ymax=10 +UAVViewer.Zmax=10 +UAVViewer.Yawmax=10