Commit 64c3c562 authored by pixhawk's avatar pixhawk

Merge branch 'master' of pixhawk.ethz.ch:groundcontrol

parents 2075abda 36a43a28
......@@ -15,5 +15,6 @@ qrc_*.cpp
tmp
debug
release
qgroundcontrol.xcodeproj/**
qgroundcontrol
qgroundcontrol *.wav
qgroundcontrol.xcodeproj/**
......
......@@ -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 \
......
# Include general settings for MAVGround
include(mavground.pri)
include(qgroundcontrol.pri)
# Include serial port library
include(src/lib/qextserialport/qextserialport.pri)
......
......@@ -49,13 +49,13 @@ using System.Speech.Synthesis;
#ifdef Q_OS_LINUX
extern "C" {
#include <flite.h>
#include <cmu_us_awb/voxdefs.h>
#include <flite.h>
#include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h>
//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 */
......@@ -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();
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment