本文整理汇总了C++中NMEAInfo类的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInfo类的具体用法?C++ NMEAInfo怎么用?C++ NMEAInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NMEAInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PDVDS
// $PDVDS,nx,nz,flap,stallratio,netto
static bool
PDVDS(NMEAInputLine &line, NMEAInfo &info)
{
fixed AccelX = line.read(fixed_zero);
fixed AccelZ = line.read(fixed_zero);
int mag = (int)hypot(AccelX, AccelZ);
info.acceleration.ProvideGLoad(fixed(mag) / 100, true);
/*
double flap = line.read(0.0);
*/
line.skip();
info.stall_ratio = line.read(fixed_zero);
info.stall_ratio_available.Update(info.clock);
fixed value;
if (line.read_checked(value))
info.ProvideNettoVario(value / 10);
//hasVega = true;
return true;
}
示例2: assert
void
CirclingComputer::TurnRate(CirclingInfo &circling_info,
const NMEAInfo &basic, const NMEAInfo &last_basic,
const DerivedInfo &calculated,
const DerivedInfo &last_calculated)
{
if (!basic.time_available || !last_basic.time_available ||
!calculated.flight.flying) {
circling_info.turn_rate = fixed_zero;
circling_info.turn_rate_heading = fixed_zero;
return;
}
if (!basic.HasTimeAdvancedSince(last_basic))
return;
// Calculate time passed since last calculation
const fixed dt = basic.time - last_basic.time;
assert(positive(dt));
circling_info.turn_rate =
(basic.track - last_basic.track).AsDelta().Degrees() / dt;
circling_info.turn_rate_heading =
(calculated.heading - last_calculated.heading).AsDelta().Degrees() / dt;
}
示例3: line
bool
EWMicroRecorderDevice::ParseNMEA(const char *String, NMEAInfo &info)
{
if (!VerifyNMEAChecksum(String))
return false;
NMEAInputLine line(String);
char type[16];
line.read(type, 16);
if (StringIsEqual(type, "$PGRMZ")) {
fixed value;
/* The normal Garmin $PGRMZ line contains the "true" barometric
altitude above MSL (corrected with QNH), but EWMicroRecorder
differs here slightly: it emits the uncorrected barometric
altitude. That is the only reason why we catch this sentence
in the driver instead of letting the generic class NMEAParser
do it. */
if (ReadAltitude(line, value))
info.ProvidePressureAltitude(value);
return true;
} else
return false;
}
示例4: ResetFlight
bool
GlideComputerAirData::FlightTimes(const NMEAInfo &basic,
const NMEAInfo &last_basic,
DerivedInfo &calculated,
const ComputerSettings &settings)
{
if (basic.gps.replay != last_basic.gps.replay)
// reset flight before/after replay logger
ResetFlight(calculated, settings, basic.gps.replay);
if (basic.time_available && basic.HasTimeRetreatedSince(last_basic)) {
// 20060519:sgi added (basic.Time != 0) due to always return here
// if no GPS time available
if (basic.location_available)
// Reset statistics.. (probably due to being in IGC replay mode)
ResetFlight(calculated, settings, false);
return false;
}
FlightState(basic, last_basic, calculated, calculated.flight,
settings.polar.glide_polar_task);
return true;
}
示例5: Reset
void
FlyingComputer::Compute(fixed takeoff_speed,
const NMEAInfo &basic, const NMEAInfo &last_basic,
const DerivedInfo &calculated,
FlyingState &flying)
{
if (basic.HasTimeRetreatedSince(last_basic)) {
Reset();
flying.Reset();
}
// GPS not lost
if (!basic.location_available)
return;
// Speed too high for being on the ground
const fixed speed = basic.airspeed_available
? std::max(basic.true_airspeed, basic.ground_speed)
: basic.ground_speed;
if (speed > takeoff_speed ||
(calculated.altitude_agl_valid && calculated.altitude_agl > fixed(300)))
Moving(flying, basic.time, basic.location);
else
Stationary(flying, basic.time, basic.location);
}
示例6: PZAN3
static bool
PZAN3(NMEAInputLine &line, NMEAInfo &info)
{
// old: $PZAN3,+,026,V,321,035,A,321,035,V*cc
// new: $PZAN3,+,026,A,321,035,V[,A]*cc
line.Skip(3);
int direction, speed;
if (!line.ReadChecked(direction) || !line.ReadChecked(speed))
return false;
char okay = line.ReadFirstChar();
if (okay == 'V') {
okay = line.ReadFirstChar();
if (okay == 'V')
return true;
if (okay != 'A') {
line.Skip();
okay = line.ReadFirstChar();
}
}
if (okay == 'A') {
SpeedVector wind(Angle::Degrees(direction),
Units::ToSysUnit(fixed(speed), Unit::KILOMETER_PER_HOUR));
info.ProvideExternalWind(wind);
}
return true;
}
示例7: ParsePITV3
static bool
ParsePITV3(NMEAInputLine &line, NMEAInfo &info)
{
fixed value;
// bank angle [degrees, positive right]
if (line.ReadChecked(value)) {
info.attitude.bank_angle_available.Update(info.clock);
info.attitude.bank_angle = Angle::Degrees(value);
}
// pitch angle [degrees, positive up]
if (line.ReadChecked(value)) {
info.attitude.pitch_angle_available.Update(info.clock);
info.attitude.pitch_angle = Angle::Degrees(value);
}
// heading [degrees]
if (line.ReadChecked(value)) {
info.attitude.heading_available.Update(info.clock);
info.attitude.heading = Angle::Degrees(value);
}
// IAS [m/s]
if (line.ReadChecked(value)) {
info.ProvideIndicatedAirspeed(value);
}
// Load factor [g]
if (line.ReadChecked(value)) {
info.acceleration.ProvideGLoad(value, true);
}
return true;
}
示例8: vl_PGCS1
// RMN: Volkslogger
// Source data:
// $PGCS,1,0EC0,FFF9,0C6E,02*61
// $PGCS,1,0EC0,FFFA,0C6E,03*18
static bool
vl_PGCS1(NMEAInputLine &line, NMEAInfo &info)
{
if (line.Read(1) != 1)
return false;
/* pressure sensor */
line.Skip();
// four characers, hex, barometric altitude
unsigned u_altitude;
if (line.ReadHexChecked(u_altitude)) {
int altitude(u_altitude);
if (altitude > 60000)
/* Assuming that altitude has wrapped around. 60 000 m occurs
at QNH ~2000 hPa */
altitude -= 65535;
info.ProvidePressureAltitude(fixed(altitude));
}
// ExtractParameter(String,ctemp,3);
// four characters, hex, constant. Value 1371 (dec)
// nSatellites = (int)(min(12,HexStrToDouble(ctemp, NULL)));
return false;
}
示例9: LXWP0
static bool
LXWP0(NMEAInputLine &line, NMEAInfo &info)
{
/*
$LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1
0 loger_stored (Y/N)
1 IAS (kph) ----> Condor uses TAS!
2 baroaltitude (m)
3-8 vario (m/s) (last 6 measurements in last second)
9 heading of plane
10 windcourse (deg)
11 windspeed (kph)
*/
line.Skip();
fixed airspeed;
bool tas_available = line.ReadChecked(airspeed);
if (tas_available && (airspeed < fixed(-50) || airspeed > fixed(250)))
/* implausible */
return false;
fixed value;
if (line.ReadChecked(value))
/* a dump on a LX7007 has confirmed that the LX sends uncorrected
altitude above 1013.25hPa here */
info.ProvidePressureAltitude(value);
if (tas_available)
/*
* Call ProvideTrueAirspeed() after ProvidePressureAltitude() to use
* the provided altitude (if available)
*/
info.ProvideTrueAirspeed(Units::ToSysUnit(airspeed, Unit::KILOMETER_PER_HOUR));
if (line.ReadChecked(value))
info.ProvideTotalEnergyVario(value);
line.Skip(6);
SpeedVector wind;
if (ReadSpeedVector(line, wind))
info.ProvideExternalWind(wind);
return true;
}
示例10: LeonardoParseD
/**
* Parse a "$D" sentence.
*
* Example: "$D,+0,100554,+25,18,+31,,0,-356,+25,+11,115,96*6A"
*/
static bool
LeonardoParseD(NMEAInputLine &line, NMEAInfo &info)
{
double value;
// 0 = vario [dm/s]
if (line.ReadChecked(value))
info.ProvideTotalEnergyVario(value / 10);
if (line.Rest().empty())
/* short "$D" sentence ends after vario */
return true;
// 1 = air pressure [Pa]
if (line.ReadChecked(value))
info.ProvideStaticPressure(AtmosphericPressure::Pascal(value));
// 2 = netto vario [dm/s]
if (line.ReadChecked(value))
info.ProvideNettoVario(value / 10);
// 3 = airspeed [km/h]
/* XXX is that TAS or IAS? */
if (line.ReadChecked(value))
info.ProvideTrueAirspeed(Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR));
// 4 = temperature [deg C]
double oat;
info.temperature_available = line.ReadChecked(oat);
if (info.temperature_available)
info.temperature = CelsiusToKelvin(oat);
// 5 = compass [degrees]
/* XXX unsupported by XCSoar */
// 6 = optimal speed [km/h]
/* XXX unsupported by XCSoar */
// 7 = equivalent MacCready [cm/s]
/* XXX unsupported by XCSoar */
// 8 = wind speed [km/h]
/* not used here, the "$C" record repeats it together with the
direction */
return true;
}
示例11: if
/**
* Parses a RMC sentence
*
* $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a,m,*hh
*
* Field Number:
* 1) UTC Time
* 2) Status, V=Navigation receiver warning A=Valid
* 3) Latitude
* 4) N or S
* 5) Longitude
* 6) E or W
* 7) Speed over ground, knots
* 8) Track made good, degrees true
* 9) Date, ddmmyy
* 10) Magnetic Variation, degrees
* 11) E or W
* 12) FAA mode indicator (NMEA 2.3 and later)
* 13) Checksum
* @param String Input string
* @param params Parameter array
* @param nparams Number of parameters
* @param info NMEA_INFO struct to parse into
* @return Parsing success
*/
bool
NMEAParser::RMC(NMEAInputLine &line, NMEAInfo &info)
{
fixed ThisTime = line.read(fixed_zero);
bool gpsValid = !NAVWarn(line.read_first_char());
GeoPoint location;
bool valid_location = ReadGeoPoint(line, location);
GPSState &gps = info.gps;
fixed speed;
bool GroundSpeedAvailable = line.read_checked(speed);
fixed track;
bool track_available = line.read_checked(track);
// JMW get date info first so TimeModify is accurate
if (ReadDate(line, info.date_time_utc))
info.date_available = true;
ThisTime = TimeModify(ThisTime, info.date_time_utc, info.date_available);
ThisTime = TimeAdvanceTolerance(ThisTime);
if (!TimeHasAdvanced(ThisTime, info))
return true;
if (!gpsValid)
info.location_available.Clear();
else if (valid_location)
info.location_available.Update(info.clock);
if (valid_location)
info.location = location;
if (GroundSpeedAvailable) {
info.ground_speed = Units::ToSysUnit(speed, unKnots);
info.ground_speed_available.Update(info.clock);
}
if (track_available && info.MovementDetected()) {
// JMW don't update bearing unless we're moving
info.track = Angle::degrees(track).as_bearing();
info.track_available.Update(info.clock);
}
if (!GGAAvailable) {
// update SatInUse, some GPS receiver don't emit GGA sentence
gps.satellites_used = -1;
}
info.gps.real = real;
#ifdef ANDROID
info.gps.android_internal_gps = false;
#endif
return true;
}
示例12: fixed
bool
NMEAParser::PTAS1(NMEAInputLine &line, NMEAInfo &info)
{
/*
* $PTAS1,xxx,yyy,zzzzz,aaa*CS<CR><LF>
*
* xxx
* CV or current vario. =vario*10+200 range 0-400(display +/-20.0 knots)
*
* yyy
* AV or average vario. =vario*10+200 range 0-400(display +/-20.0 knots)
*
* zzzzz
* Barometric altitude in feet +2000
*
* aaa
* TAS knots 0-200
*/
// Parse current vario data
fixed vario;
if (line.ReadChecked(vario)) {
// Properly convert to m/s
vario = Units::ToSysUnit((vario - fixed(200)) / 10, Unit::KNOTS);
info.ProvideTotalEnergyVario(vario);
}
// Skip average vario data
line.Skip();
// Parse barometric altitude
fixed baro_altitude;
if (line.ReadChecked(baro_altitude)) {
// Properly convert to meter
baro_altitude = Units::ToSysUnit(baro_altitude - fixed(2000), Unit::FEET);
info.ProvidePressureAltitude(baro_altitude);
}
// Parse true airspeed
fixed vtas;
if (line.ReadChecked(vtas))
info.ProvideTrueAirspeed(Units::ToSysUnit(vtas, Unit::KNOTS));
return true;
}
示例13: ComputeAirspeed
/**
* Attempt to compute airspeed when it is not yet available from:
* 1) dynamic pressure and air density derived from some altitude.
* 2) pitot pressure and static pressure.
* 3) ground speed and wind.
*/
static void
ComputeAirspeed(NMEAInfo &basic, const DerivedInfo &calculated)
{
if (basic.airspeed_available && basic.airspeed_real)
/* got it already */
return;
const auto any_altitude = basic.GetAnyAltitude();
if (!basic.airspeed_available && any_altitude.first) {
fixed dyn; bool available = false;
if (basic.dyn_pressure_available) {
dyn = basic.dyn_pressure.GetHectoPascal();
available = true;
} else if (basic.pitot_pressure_available && basic.static_pressure_available) {
dyn = basic.pitot_pressure.GetHectoPascal() - basic.static_pressure.GetHectoPascal();
available = true;
}
if (available) {
basic.indicated_airspeed = sqrt(fixed(163.2653061) * dyn);
basic.true_airspeed = basic.indicated_airspeed *
AirDensityRatio(any_altitude.second);
basic.airspeed_available.Update(basic.clock);
basic.airspeed_real = true; // Anyway not less real then any other method.
return;
}
}
if (!basic.ground_speed_available || !calculated.wind_available ||
!calculated.flight.flying) {
/* impossible to calculate */
basic.airspeed_available.Clear();
return;
}
fixed TrueAirspeedEstimated = fixed(0);
const SpeedVector wind = calculated.wind;
if (positive(basic.ground_speed) || wind.IsNonZero()) {
fixed x0 = basic.track.fastsine() * basic.ground_speed;
fixed y0 = basic.track.fastcosine() * basic.ground_speed;
x0 += wind.bearing.fastsine() * wind.norm;
y0 += wind.bearing.fastcosine() * wind.norm;
TrueAirspeedEstimated = SmallHypot(x0, y0);
}
basic.true_airspeed = TrueAirspeedEstimated;
basic.indicated_airspeed = TrueAirspeedEstimated;
if (any_altitude.first)
basic.indicated_airspeed /= AirDensityRatio(any_altitude.second);
basic.airspeed_available.Update(basic.clock);
basic.airspeed_real = false;
}
示例14: PWES0
/**
* $PWES0,DD,VVVV,MMMM,NNNN,BBBB,SSSS,AAAAA,QQQQQ,IIII,TTTT,UUU,CCC*CS<CR><LF>
*/
static bool
PWES0(NMEAInputLine &line, NMEAInfo &info)
{
int i, k;
line.skip(); /* device */
if (line.read_checked(i))
info.ProvideTotalEnergyVario(fixed(i) / 10);
line.skip(); /* average vario */
if (line.read_checked(i))
info.ProvideNettoVario(fixed(i) / 10);
line.skip(); /* average netto vario */
line.skip(); /* speed to fly */
if (line.read_checked(i))
info.ProvidePressureAltitude(fixed(i));
if (line.read_checked(i))
info.ProvideBaroAltitudeTrue(fixed(i));
bool have_ias = line.read_checked(i);
bool have_tas = line.read_checked(k);
if (have_ias && have_tas)
info.ProvideBothAirspeeds(Units::ToSysUnit(fixed(i) / 10,
unKiloMeterPerHour),
Units::ToSysUnit(fixed(k) / 10,
unKiloMeterPerHour));
if (line.read_checked(i)) {
info.voltage = fixed(i) / 10;
info.voltage_available.Update(info.clock);
}
if (line.read_checked(i)) {
info.temperature = Units::ToSysUnit(fixed(i) / 10, unGradCelcius);
info.temperature_available = true;
}
return true;
}
示例15: cLXWP0
static bool
cLXWP0(NMEAInputLine &line, NMEAInfo &info)
{
/*
$LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1
0 logger_stored (Y/N)
1 IAS (kph) ----> Condor uses TAS!
2 baroaltitude (m)
3 vario (m/s)
4-8 unknown
9 heading of plane
10 windcourse (deg)
11 windspeed (kph)
*/
fixed value;
line.Skip();
fixed airspeed;
bool tas_available = line.ReadChecked(airspeed);
fixed alt = line.Read(fixed_zero);
if (tas_available)
info.ProvideTrueAirspeedWithAltitude(Units::ToSysUnit(airspeed,
Unit::KILOMETER_PER_HOUR),
alt);
// ToDo check if QNH correction is needed!
info.ProvideBaroAltitudeTrue(alt);
if (line.ReadChecked(value))
info.ProvideTotalEnergyVario(value);
line.Skip(6);
SpeedVector wind;
if (ReadSpeedVector(line, wind))
info.ProvideExternalWind(wind);
return true;
}