本文整理汇总了C++中NMEAInfo::ProvideNoncompVario方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInfo::ProvideNoncompVario方法的具体用法?C++ NMEAInfo::ProvideNoncompVario怎么用?C++ NMEAInfo::ProvideNoncompVario使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAInfo
的用法示例。
在下文中一共展示了NMEAInfo::ProvideNoncompVario方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strtol
bool
BlueFlyDevice::ParsePRS(const char *content, NMEAInfo &info)
{
// e.g. PRS 17CBA
char *endptr;
long value = strtol(content, &endptr, 16);
if (endptr != content) {
AtmosphericPressure pressure = AtmosphericPressure::Pascal(fixed(value));
kalman_filter.Update(pressure.GetHectoPascal(), fixed(0.25), fixed(0.02));
info.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
kalman_filter.GetXVel()));
info.ProvideStaticPressure(AtmosphericPressure::HectoPascal(kalman_filter.GetXAbs()));
}
return true;
}
示例2: fixed
static bool
LK8EX1(NMEAInputLine &line, NMEAInfo &info)
{
unsigned pressure;
bool pressure_available = (line.ReadChecked(pressure) && pressure != 999999);
if (pressure_available)
info.ProvideStaticPressure(AtmosphericPressure::Pascal(fixed(pressure)));
unsigned altitude;
bool altitude_available = (line.ReadChecked(altitude) && altitude != 99999);
if (altitude_available && !pressure_available)
info.ProvidePressureAltitude(fixed(altitude));
int vario;
if (line.ReadChecked(vario) && vario != 9999)
info.ProvideNoncompVario(fixed(vario) / 100);
int temperature;
if (line.ReadChecked(temperature) && temperature != 99) {
info.temperature = fixed(temperature);
info.temperature_available = true;
}
fixed battery_value;
if (line.ReadChecked(battery_value) &&
(unsigned)(battery_value + fixed(0.5)) != 999) {
if (battery_value > fixed(1000)) {
info.battery_level = battery_value - fixed(1000);
info.battery_level_available.Update(info.clock);
} else {
info.voltage = battery_value;
info.voltage_available.Update(info.clock);
}
}
return true;
}
示例3: strtol
bool
FlyNetDevice::ParsePRS(const char *content, NMEAInfo &info)
{
// e.g. _PRS 00017CBA
// The frequency at which the device sends _PRS sentences
static constexpr double frequency = 1 / 0.048;
char *endptr;
long value = strtol(content, &endptr, 16);
if (endptr != content) {
auto pressure = AtmosphericPressure::Pascal(value);
if (info.static_pressure_available) {
// Calculate non-compensated vario value
auto last_pressure = info.static_pressure;
auto alt = AtmosphericPressure::StaticPressureToPressureAltitude(pressure);
auto last_alt = AtmosphericPressure::StaticPressureToPressureAltitude(last_pressure);
auto vario = (alt - last_alt) * frequency;
vario_filter.Update(vario);
auto vario_filtered = vario_filter.Average();
info.ProvideNoncompVario(vario_filtered);
} else {
// Reset filter when the first new pressure sentence is received
vario_filter.Reset();
}
info.ProvideStaticPressure(pressure);
}
return true;
}