QGCHilJSBSimConfiguration.cc 1.21 KB
Newer Older
1 2 3 4
#include "QGCHilJSBSimConfiguration.h"
#include "ui_QGCHilJSBSimConfiguration.h"

#include "MainWindow.h"
5
#include "UAS.h"
6

7 8 9 10
QGCHilJSBSimConfiguration::QGCHilJSBSimConfiguration(Vehicle* vehicle, QWidget *parent)
    : QWidget(parent)
    , _vehicle(vehicle)
    , ui(new Ui::QGCHilJSBSimConfiguration)
11 12 13 14
{
    ui->setupUi(this);

    QStringList items = QStringList();
15
    if (_vehicle->vehicleType() == MAV_TYPE_FIXED_WING)
16 17 18 19 20 21 22
    {
        items << "EasyStar";
        items << "Rascal110-JSBSim";
        items << "c172p";
        items << "YardStik";
        items << "Malolo1";
    }
23
    else if (_vehicle->vehicleType() == MAV_TYPE_QUADROTOR)
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    {
        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());
44
    _vehicle->uas()->enableHilJSBSim(true,  options);
45 46 47 48
}

void QGCHilJSBSimConfiguration::on_stopButton_clicked()
{
49
    _vehicle->uas()->stopHil();
50
}