本文整理汇总了C++中TinyGPS::altitude方法的典型用法代码示例。如果您正苦于以下问题:C++ TinyGPS::altitude方法的具体用法?C++ TinyGPS::altitude怎么用?C++ TinyGPS::altitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TinyGPS
的用法示例。
在下文中一共展示了TinyGPS::altitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encodeTargetData
void encodeTargetData(uint8_t c){
if (gps.encode(c)){
float flat, flon;
unsigned long fix_age;
gps.f_get_position(&flat, &flon, &fix_age);
if (fix_age == TinyGPS::GPS_INVALID_AGE){
hasFix = false;
}
else if (fix_age > 5000){
hasFix = false;
}
else{
gps.get_position(&lat,&lon);
hasFix = true;
}
if(gps.altitude() != TinyGPS::GPS_INVALID_ALTITUDE) {
alt = (int16_t)gps.altitude();
hasAlt = true;
}else{
hasAlt = false;
}
}
}
示例2: gps_spinOnce
/* GPS listen thread */
void gps_spinOnce(void) {
if(rx_ready(gps_port)) {
gps_input = rx_byte(gps_port);
if(gps.encode(gps_input)) {
gps.get_position(&lat, &lon);
if( gps_pub.reset() ) {
gps_pub.append(lat);
gps_pub.append(lon);
// TODO: fill in rest of GPS message
gps_pub.append(gps.altitude());
gps_pub.append(gps.hdop());
gps_pub.finish();
}
if( gps_pub2.reset() ) {
gps_pub2.append(lat);
gps_pub2.append(lon);
// TODO: fill in rest of GPS message
gps_pub2.finish();
}
}
}
}
示例3: encodeTargetData
void encodeTargetData(uint8_t c) {
if (remoteGps.encode(c)) {
unsigned long fix_age;
remoteGps.get_position(&lat, &lon, &fix_age);
if (fix_age == TinyGPS::GPS_INVALID_AGE) {
HAS_FIX = false;
} else if (fix_age > 5000) {
HAS_FIX = false;
} else {
//TODO valid data
lat = lat / 10;
lon = lon / 10;
if (remoteGps.altitude() != TinyGPS::GPS_INVALID_ALTITUDE) {
alt = int16_t(remoteGps.altitude() / 100);
HAS_ALT = true;
}
HAS_FIX = true;
}
}
}