Example #1
0
bool
AP_IMU_INS::update(void)
{
    //float gyros[3];
    //float accels[3];

    _ins->update();
    //_ins->get_gyros(gyros);
    //_ins->get_accels(accels);
    _sample_time = _ins->sample_time();

    // convert corrected gyro readings to delta acceleration
    //
    _gyro.x = /*_gyro.x * 0.7 + 0.3 **/ _calibrated(0, _ins->gyro[0]);
    _gyro.y = /*_gyro.y * 0.7 + 0.3 **/ _calibrated(1, _ins->gyro[1]);
    _gyro.z = /*_gyro.z * 0.7 + 0.3 **/ _calibrated(2, _ins->gyro[2]);

    // convert corrected accelerometer readings to acceleration
    //
    _accel.x = _calibrated(3, _ins->accel[0]);
    _accel.y = _calibrated(4, _ins->accel[1]);
    _accel.z = _calibrated(5, _ins->accel[2]);

    // always updated
    return true;
}
bool
AP_IMU_INS::update(void)
{
    float gyros[3];
    float accels[3];

    _ins->update();
    _ins->get_gyros(gyros);
    _ins->get_accels(accels);
    _sample_time = _ins->sample_time();

    // convert corrected gyro readings to delta acceleration
    //
    _gyro.x = _calibrated(0, gyros[0]);
    _gyro.y = _calibrated(1, gyros[1]);
    _gyro.z = _calibrated(2, gyros[2]);

    // convert corrected accelerometer readings to acceleration
    //
    _accel.x = _calibrated(3, accels[0]);
    _accel.y = _calibrated(4, accels[1]);
    _accel.z = _calibrated(5, accels[2]);

    // always updated
    return true;
}