示例#1
0
void AP_Baro_HIL::setHIL(float altitude_msl)
{
    float sigma, delta, theta;
    const float p0 = 101325;

    SimpleAtmosphere(altitude_msl*0.001, sigma, delta, theta);
    float p = p0 * delta;
    float T = 303.16 * theta - 273.16; // Assume 30 degrees at sea level - converted to degrees Kelvin

    _count++;
    _pressure_sum += p;
    _temperature_sum += T;

    if (_count == 128) {
        // we have summed 128 values. This only happens
        // when we stop reading the barometer for a long time
        // (more than 1.2 seconds)
        _count = 64;
        _pressure_sum /= 2;
        _temperature_sum /= 2;
    }

    healthy = true;
    _last_update = hal.scheduler->millis();
}
示例#2
0
void AP_Baro_HIL::setHIL(float altitude_msl)
{
    float sigma, delta, theta;
    const float p0 = 101325;

    SimpleAtmosphere(altitude_msl*0.001f, sigma, delta, theta);
    float p = p0 * delta;
    float T = 303.16f * theta - 273.16f; // Assume 30 degrees at sea level - converted to degrees Kelvin

    setHIL(p, T);
}
示例#3
0
/*
  convert an altitude in meters above sea level to a presssure and temperature
 */
void AP_Baro::setHIL(float altitude_msl)
{
    float sigma, delta, theta;
    const float p0 = 101325;

    SimpleAtmosphere(altitude_msl*0.001f, sigma, delta, theta);
    float p = p0 * delta;
    float T = 303.16f * theta - C_TO_KELVIN; // Assume 30 degrees at sea level - converted to degrees Kelvin

    _hil.pressure = p;
    _hil.temperature = T;
    _hil.updated = true;
}