QGCHilJSBSimConfiguration.cc 1.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include "QGCHilJSBSimConfiguration.h"
#include "ui_QGCHilJSBSimConfiguration.h"

#include "MainWindow.h"

QGCHilJSBSimConfiguration::QGCHilJSBSimConfiguration(UAS* mav,QWidget *parent) :
    QWidget(parent),
    mav(mav),
    ui(new Ui::QGCHilJSBSimConfiguration)
{
    ui->setupUi(this);

    QStringList items = QStringList();
    if (mav->getSystemType() == MAV_TYPE_FIXED_WING)
    {
        items << "EasyStar";
        items << "Rascal110-JSBSim";
        items << "c172p";
        items << "YardStik";
        items << "Malolo1";
    }
    else if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
    {
        items << "arducopter";
    }
    else
    {
        items << "<aircraft>";
    }
    ui->aircraftComboBox->addItems(items);
}

QGCHilJSBSimConfiguration::~QGCHilJSBSimConfiguration()
{
    delete ui;
}

void QGCHilJSBSimConfiguration::on_startButton_clicked()
{
    //XXX check validity of inputs
    QString options = ui->optionsPlainTextEdit->toPlainText();
    options.append(" --script=" + ui->aircraftComboBox->currentText());
    mav->enableHilJSBSim(true,  options);
}

void QGCHilJSBSimConfiguration::on_stopButton_clicked()
{
    mav->stopHil();
}