示例#1
0
void MickeyCalibration::cancelPressed()
{
  timer.stop();
  if(calState == CALIBRATE){
    emit cancelCalibration(true);
  }else{
    emit cancelCalibration(false);
  }
  hide();
}
示例#2
0
DdeFaceTracker::~DdeFaceTracker() {
    setEnabled(false);

    if (_isCalibrating) {
        cancelCalibration();
    }
}
void CompassMotorCalibrationDialog::okButtonClicked()
{
    if(m_uasInterface){
        cancelCalibration();
        QLOG_DEBUG() << "COMPASSMOT: accepted = retrieving new values";
        m_uasInterface->requestParameter(1, "COMPASS_MOT_X");
        m_uasInterface->requestParameter(1, "COMPASS_MOT_Y");
        m_uasInterface->requestParameter(1, "COMPASS_MOT_Z");
        QMessageBox::information(this, "Sucess!",
                                 QString("New values have been stored\n X:%1 Y:%2 Z:%3")
                                 .arg(QString::number(x_scalar))
                                 .arg(QString::number(y_scalar))
                                 .arg(QString::number(z_scalar)));
    }
    accept();
}
CompassMotorCalibrationDialog::CompassMotorCalibrationDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CompassMotorCalibrationDialog),
    m_uasInterface(NULL)
{
    ui->setupUi(this);

    QCustomPlot* customPlot = ui->customPlot;
    customPlot->addGraph();
    customPlot->graph(GRAPH_ID_INTERFERENCE)->setPen(QPen(GRAPH_COLOR_INTERFERENCE)); // line color blue for first graph
    customPlot->graph(GRAPH_ID_INTERFERENCE)->setBrush(QBrush(GRAPH_COLOR_INTERFERENCE_FILL)); // first graph will be filled with translucent blue

    customPlot->xAxis->setLabel("Throttle (%)");

    customPlot->yAxis->setLabel("Interference (%)");
    customPlot->yAxis->setLabelColor(GRAPH_COLOR_INTERFERENCE);
    customPlot->xAxis->setRange(0,100);
    customPlot->yAxis->setRange(0,100);

    customPlot->addGraph();
    customPlot->graph(GRAPH_ID_CURRENT)->setPen(QPen(GRAPH_COLOR_CURRENT)); // line color red for second graph
    customPlot->graph(GRAPH_ID_CURRENT)->setBrush(QBrush(GRAPH_COLOR_CURRENT_FILL));

    customPlot->yAxis2->setVisible(true);
    customPlot->yAxis2->setLabel("Amps (A)");
    customPlot->yAxis2->setLabelColor(GRAPH_COLOR_CURRENT);
    customPlot->xAxis2->setRange(0,100);
    customPlot->yAxis2->setRange(0,50);

    customPlot->replot();

    connect(ui->okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
    connect(this, SIGNAL(about), this, SLOT(rejected()));
    connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
    activeUASSet(UASManager::instance()->getActiveUAS());

    int ok = QMessageBox::warning(this, "Compass Motor Calibration", tr("CAUTION: Starting the compass motor calibration arms the motors.\n"
                                                               "Please make sure you have read and followed all instructions"
                                                               "before untertaking the calibration as serious injury could occur!"),
                         QMessageBox::Ok, QMessageBox::Cancel);
    if (ok == QMessageBox::Cancel){
        QTimer::singleShot(100, this, SLOT(cancelCalibration()));
    }

}
示例#5
0
void DdeFaceTracker::setEnabled(bool enabled) {
    if (!_isInitialized) {
        // Don't enable until have explicitly initialized
        return;
    }
#ifdef HAVE_DDE

    if (_isCalibrating) {
        cancelCalibration();
    }


    // isOpen() does not work as one might expect on QUdpSocket; don't test isOpen() before closing socket.
    _udpSocket.close();
    if (enabled) {
        _udpSocket.bind(_host, _serverPort);
    }

    const char* DDE_EXIT_COMMAND = "exit";

    if (enabled && !_ddeProcess) {
        // Terminate any existing DDE process, perhaps left running after an Interface crash
        _udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
        _ddeStopping = false;

        qCDebug(interfaceapp) << "DDE Face Tracker: Starting";
        _ddeProcess = new QProcess(qApp);
        connect(_ddeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
        _ddeProcess->start(QCoreApplication::applicationDirPath() + DDE_PROGRAM_PATH, DDE_ARGUMENTS);
    }

    if (!enabled && _ddeProcess) {
        _ddeStopping = true;
        _udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
        qCDebug(interfaceapp) << "DDE Face Tracker: Stopping";
    }
#endif
}
CompassMotorCalibrationDialog::~CompassMotorCalibrationDialog()
{
    cancelCalibration();
    delete ui;
}
void CompassMotorCalibrationDialog::closeEvent(QCloseEvent *)
{
    cancelCalibration();
}