Пример #1
0
    HRESULT readingChanged(IInclinometer *, IInclinometerReadingChangedEventArgs *args)
    {
        ComPtr<IInclinometerReading> value;
        HRESULT hr = args->get_Reading(&value);
        if (FAILED(hr)) {
            qCWarning(lcWinRtSensors) << "Failed to get rotation reading" << qt_error_string(hr);
            return hr;
        }

        FLOAT x;
        hr = value->get_PitchDegrees(&x);
        if (FAILED(hr))
            qCWarning(lcWinRtSensors) << "Failed to get rotation X" << qt_error_string(hr);

        FLOAT y;
        hr = value->get_RollDegrees(&y);
        if (FAILED(hr))
            qCWarning(lcWinRtSensors) << "Failed to get rotation Y" << qt_error_string(hr);

        FLOAT z;
        hr = value->get_YawDegrees(&z);
        if (FAILED(hr))
            qCWarning(lcWinRtSensors) << "Failed to get rotation Z" << qt_error_string(hr);

        DateTime dateTime;
        hr = value->get_Timestamp(&dateTime);
        if (FAILED(hr))
            qCWarning(lcWinRtSensors) << "Failed to get rotation timestamp" << qt_error_string(hr);

        reading.setFromEuler(x, y, z);
        reading.setTimestamp(dateTimeToMsSinceEpoch(dateTime));
        q->newReadingAvailable();

        return S_OK;
    }
static void release_QRotationReading(void *sipCppV,int)
{
    QRotationReading *sipCpp = reinterpret_cast<QRotationReading *>(sipCppV);

    if (QThread::currentThread() == sipCpp->thread())
        delete sipCpp;
    else
        sipCpp->deleteLater();
}
Пример #3
0
void AsemanSensors::rtt_reading()
{
    if( !p->gravity->reading() )
        return;

    QRotationReading *rd = p->rotation->reading();
    p->pr_vector.x = rd->x();
    p->pr_vector.y = rd->y();
    p->pr_vector.z = rd->z();
    refresh();
}
Пример #4
0
void Rotation::logValues(void)
{
    if(isLogging()) {
        QRotationSensor *rotation = dynamic_cast<QRotationSensor*>(m_sensor);
        QRotationReading *reading = rotation->reading();

        QString line = QString("%1\t%2\t%3\t%4\n")
                               .arg(QDateTime::currentMSecsSinceEpoch()/1000.0, 0, 'f', 3)
                               .arg(reading->x())
                               .arg(reading->y())
                               .arg(reading->z());

        m_logFile.write(line.toUtf8());
    }
}
Пример #5
0
void Rotation::refresh(void)
{
    if(!m_sensor->isActive()) {
        return;
    }

    QRotationSensor *rotation = dynamic_cast<QRotationSensor*>(m_sensor);
    QRotationReading *reading = rotation->reading();

    m_rx = reading->x();
    m_ry = reading->y();
    m_rz = reading->z();

    emit rxChanged();
    emit ryChanged();
    emit rzChanged();
}
static PyObject *meth_QRotationReading_setFromEuler(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        qreal a0;
        qreal a1;
        qreal a2;
        QRotationReading *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bddd", &sipSelf, sipType_QRotationReading, &sipCpp, &a0, &a1, &a2))
        {
            sipCpp->setFromEuler(a0,a1,a2);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QRotationReading, sipName_setFromEuler, doc_QRotationReading_setFromEuler);

    return NULL;
}