diff --git a/.gitignore b/.gitignore index 7c993aa..b78ebc4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,6 @@ qrc_*.cpp tmp debug release -qgroundcontrol.xcodeproj/** -qgroundcontrol +qgroundcontrol *.wav +qgroundcontrol.xcodeproj/** + diff --git a/lib/flite/linux32/libflite_cmu_time_awb.a b/lib/flite/linux32/libflite_cmu_time_awb.a deleted file mode 100644 index d798169..0000000 Binary files a/lib/flite/linux32/libflite_cmu_time_awb.a and /dev/null differ diff --git a/lib/flite/linux32/libflite_cmu_us_awb.a b/lib/flite/linux32/libflite_cmu_us_awb.a deleted file mode 100644 index 873ff19..0000000 Binary files a/lib/flite/linux32/libflite_cmu_us_awb.a and /dev/null differ diff --git a/lib/flite/linux32/libflite_cmu_us_kal.a b/lib/flite/linux32/libflite_cmu_us_kal.a deleted file mode 100644 index 630ad11..0000000 Binary files a/lib/flite/linux32/libflite_cmu_us_kal.a and /dev/null differ diff --git a/lib/flite/linux32/libflite_cmu_us_kal16.a b/lib/flite/linux32/libflite_cmu_us_kal16.a deleted file mode 100644 index 32d6806..0000000 Binary files a/lib/flite/linux32/libflite_cmu_us_kal16.a and /dev/null differ diff --git a/mavground.pri b/qgroundcontrol.pri similarity index 96% rename from mavground.pri rename to qgroundcontrol.pri index 5ee7c67..1a81b2a 100644 --- a/mavground.pri +++ b/qgroundcontrol.pri @@ -40,11 +40,6 @@ OBJECTS_DIR = $$BUILDDIR/obj MOC_DIR = $$BUILDDIR/moc UI_HEADERS_DIR = src/ui/generated - -# Add external libraries -INCLUDEPATH += $$BASEDIR/lib/flite/include \ - $$BASEDIR/lib/flite/lang - #$$BASEDIR/lib/qextserialport/include # $$BASEDIR/lib/openjaus/libjaus/include \ # $$BASEDIR/lib/openjaus/libopenJaus/include @@ -99,7 +94,10 @@ linux-g++ { release { DESTDIR = $$BASEDIR } - INCLUDEPATH += /usr/include + INCLUDEPATH += /usr/include \ + $$BASEDIR/lib/flite/include \ + $$BASEDIR/lib/flite/lang + HARDWARE_PLATFORM = $$system(uname -a) contains( HARDWARE_PLATFORM, x86_64 ) { @@ -114,7 +112,6 @@ linux-g++ { message(Building for GNU/Linux 32bit/i386) } LIBS += -lm \ - -lflite_cmu_us_awb \ -lflite_cmu_us_rms \ -lflite_cmu_us_slt \ -lflite_usenglish \ diff --git a/mavground.pro b/qgroundcontrol.pro similarity index 99% rename from mavground.pro rename to qgroundcontrol.pro index 4dba7bd..6dd234c 100644 --- a/mavground.pro +++ b/qgroundcontrol.pro @@ -1,5 +1,5 @@ # Include general settings for MAVGround -include(mavground.pri) +include(qgroundcontrol.pri) # Include serial port library include(src/lib/qextserialport/qextserialport.pri) diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 4fff011..bb89549 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -49,13 +49,13 @@ using System.Speech.Synthesis; #ifdef Q_OS_LINUX extern "C" { - #include - #include +#include +#include //#include //cst_voice *REGISTER_VOX(const char *voxdir); //void UNREGISTER_VOX(cst_voice *vox); - cst_voice *register_cmu_us_awb(const char *voxdir); - void unregister_cmu_us_awb(cst_voice *vox); + //cst_voice *register_cmu_us_awb(const char *voxdir); + //void unregister_cmu_us_awb(cst_voice *vox); cst_voice *register_cmu_us_slt(const char *voxdir); void unregister_cmu_us_slt(cst_voice *vox); cst_voice *register_cmu_us_rms(const char *voxdir); @@ -92,9 +92,12 @@ emergency(false) #ifdef Q_OS_LINUX flite_init(); #endif + // Initialize audio output m_media = new Phonon::MediaObject(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); createPath(m_media, audioOutput); + + // Prepare regular emergency signal, will be fired off on calling startEmergency() emergencyTimer = new QTimer(); connect(emergencyTimer, SIGNAL(timeout()), this, SLOT(beep())); @@ -103,11 +106,8 @@ emergency(false) case 0: selectFemaleVoice(); break; - case 1: - selectMaleVoice(); - break; default: - selectNeutralVoice(); + selectMaleVoice(); break; } } @@ -133,7 +133,6 @@ bool GAudioOutput::say(QString text, int severity) // file.fileName() returns the unique file name cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str())); - qDebug() << "TYPE:" << m_media->currentSource().type(); m_media->play(); qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); res = true; @@ -150,10 +149,6 @@ bool GAudioOutput::say(QString text, int severity) SpeakString(str2); qDebug() << "Synthesized: " << text.toAscii(); #endif - -#ifdef Q_OS_WIN32 - qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!"; -#endif } return res; } @@ -228,52 +223,46 @@ void GAudioOutput::beep() void GAudioOutput::selectFemaleVoice() { #ifdef Q_OS_LINUX - //this->voice = register_cmu_us_slt(NULL); + this->voice = register_cmu_us_slt(NULL); #endif } void GAudioOutput::selectMaleVoice() { #ifdef Q_OS_LINUX - //this->voice = register_cmu_us_rms(NULL); + this->voice = register_cmu_us_rms(NULL); #endif } - +/* void GAudioOutput::selectNeutralVoice() { #ifdef Q_OS_LINUX - //this->voice = register_cmu_us_awb(NULL); + this->voice = register_cmu_us_awb(NULL); #endif -} +}*/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - QStringList GAudioOutput::listVoices(void) - { - QStringList l; +QStringList GAudioOutput::listVoices(void) +{ + QStringList l; #ifdef Q_OS_LINUX - cst_voice *voice; - const cst_val *v; + cst_voice *voice; + const cst_val *v; - /* - printf("Voices available: "); - for (v=flite_voice_list; v; v=val_cdr(v)) - { - voice = val_voice(val_car(v)); - QString s; - s.sprintf("%s",voice->name); - printf("%s",voice->name); - l.append(s); - } - printf("\n"); -*/ -#endif - return l; + printf("Voices available: "); + for (v=flite_voice_list; v; v=val_cdr(v)) + { + voice = val_voice(val_car(v)); + QString s; + s.sprintf("%s",voice->name); + printf("%s",voice->name); + l.append(s); } -#ifdef __cplusplus + printf("\n"); + +#endif + return l; + } -#endif /* __cplusplus */ diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h index c375ba2..9f1c93d 100644 --- a/src/GAudioOutput.h +++ b/src/GAudioOutput.h @@ -65,6 +65,10 @@ public: static GAudioOutput* instance(); /** @brief List available voices */ QStringList listVoices(void); + enum { + VOICE_MALE = 0, + VOICE_FEMALE + } QGVoice; public slots: /** @brief Say this text if current output priority matches */ @@ -79,8 +83,6 @@ public slots: void selectFemaleVoice(); /** @brief Select male voice */ void selectMaleVoice(); - /** @brief Select neutral voice */ - void selectNeutralVoice(); /** @brief Play emergency sound */ void beep(); diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 0427cb1..9059883 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -449,13 +449,12 @@ void HUD::paintText(QString text, QColor color, float fontSize, float refX, floa void HUD::initializeGL() { - glEnable(GL_MULTISAMPLE); - bool antialiasing = true; // Antialiasing setup if(antialiasing) { + glEnable(GL_MULTISAMPLE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); @@ -468,9 +467,9 @@ void HUD::initializeGL() } else { - glDisable(GL_BLEND); - glDisable(GL_POINT_SMOOTH); - glDisable(GL_LINE_SMOOTH); + //glDisable(GL_BLEND); + //glDisable(GL_POINT_SMOOTH); + //glDisable(GL_LINE_SMOOTH); } } @@ -513,6 +512,7 @@ void HUD::paintRollPitchStrips() void HUD::paintGL() { + // Read out most important values to limit hash table lookups float roll = roll * 0.5 + 0.5 * values.value("roll", 0.0f); float pitch = pitch * 0.5 + 0.5 * values.value("pitch", 0.0f); @@ -527,7 +527,7 @@ void HUD::paintGL() double scalingFactorH = this->height()/vheight; if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH; - makeCurrent(); + //makeCurrent(); glClear(GL_COLOR_BUFFER_BIT); //if(!noCamera) glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits()); glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits()); // FIXME Remove after testing @@ -536,22 +536,7 @@ void HUD::paintGL() // Blue / Brown background if (noCamera) paintCenterBackground(roll, pitch, yaw); - glFlush(); - - // Draw instruments - // TESTING THIS SHOULD BE MOVED INTO A QGRAPHICSVIEW - /* - QPainter painter(this); - painter.setRenderHint(QPainter::HighQualityAntialiasing); - const float gaugeWidth = 15.0f; - const QColor gaugeColor = QColor(200, 200, 200); - drawSystemIndicator(vwidth+10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); - drawGauge(vwidth+10.0f, 50.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); - drawGauge(vwidth+10.0f+gaugeWidth*1.7f, 50.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true); -*/ - // END TESTING - - + //glFlush(); // // Store current GL model view // glMatrixMode(GL_MODELVIEW); @@ -571,7 +556,7 @@ void HUD::paintGL() QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setRenderHint(QPainter::HighQualityAntialiasing, true); + //painter.setRenderHint(QPainter::HighQualityAntialiasing, true); painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor); // COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET @@ -603,6 +588,8 @@ void HUD::paintGL() painter.setPen(defaultColor); painter.drawPolyline(yawIndicator); + // CENTER + // HEADING INDICATOR // // __ __ @@ -624,6 +611,23 @@ void HUD::paintGL() painter.drawPolyline(hIndicator); + // SETPOINT + const float centerWidth = 4.0f; + painter.setPen(defaultColor); + painter.setBrush(Qt::NoBrush); + // TODO + //painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f)); + + const float centerCrossWidth = 10.0f; + // left + painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f))); + // right + painter.drawLine(QPointF(refToScreenX(centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(centerCrossWidth / 2.0f), refToScreenY(0.0f))); + // top + painter.drawLine(QPointF(refToScreenX(0.0f), refToScreenY(-centerWidth / 2.0f)), QPointF(refToScreenX(0.0f), refToScreenY(-centerCrossWidth / 2.0f))); + + + // COMPASS const float compassY = -vheight/2.0f + 10.0f; QRectF compassRect(QPointF(refToScreenX(-5.0f), refToScreenY(compassY)), QSizeF(refToScreenX(10.0f), refToScreenY(5.0f))); @@ -656,8 +660,6 @@ void HUD::paintGL() // MOVING PARTS - - // Translate for yaw const float maxYawTrans = 60.0f; float yawDiff = valuesDot.value("yaw", 0.0f); @@ -675,7 +677,7 @@ void HUD::paintGL() yawInt *= 0.6f; //qDebug() << "yaw translation" << yawTrans << "integral" << yawInt << "difference" << yawDiff << "yaw" << yaw << "asin(yawInt)" << asinYaw; - painter.translate(0, (pitch/M_PI)* -180.0f * refToScreenY(2.0f)); + painter.translate(0, (pitch/M_PI)* -180.0f * refToScreenY(1.8)); painter.translate(refToScreenX(yawTrans), 0); @@ -684,25 +686,7 @@ void HUD::paintGL() // Rotate view and draw all roll-dependent indicators painter.rotate((roll/M_PI)* -180.0f); - qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f); - - // CENTER - - // SETPOINT - const float centerWidth = 4.0f; - painter.setPen(defaultColor); - painter.setBrush(Qt::NoBrush); - // TODO - //painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f)); - - const float centerCrossWidth = 10.0f; - // left - painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f))); - // right - painter.drawLine(QPointF(refToScreenX(centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(centerCrossWidth / 2.0f), refToScreenY(0.0f))); - // top - painter.drawLine(QPointF(refToScreenX(0.0f), refToScreenY(-centerWidth / 2.0f)), QPointF(refToScreenX(0.0f), refToScreenY(-centerCrossWidth / 2.0f))); - + //qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f); // PITCH