ecologylab.sensor.gps.data
Class GPSDatum

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.xml.ElementState
          extended by ecologylab.sensor.gps.data.GPSDatum
All Implemented Interfaces:
OptimizationTypes, XMLTranslationExceptionTypes

public class GPSDatum
extends ElementState

Represents an instant of GPS data computed from a series of NMEA strings. Each component of the datum is as up-to-date as possible as of the time stamp. Whenever no new data is provided, the old data is retained.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)

Nested Class Summary
 
Nested classes/interfaces inherited from class ecologylab.xml.ElementState
ElementState.ClassToCollectionMap, ElementState.DeclarationStyle, ElementState.xml_attribute, ElementState.xml_class, ElementState.xml_classes, ElementState.xml_collection, ElementState.xml_leaf, ElementState.xml_map, ElementState.xml_nested, ElementState.xml_tag
 
Field Summary
protected  java.util.HashMap<java.lang.Integer,SVData> allSVs
          All up-to-date data on SVs that have been reported by the GPS hardware.
protected  boolean autoCalcMode
          Indicates whether or not the calculation mode (2D/3D) is automatically selected.
static int CALC_MODE_2D
          Indicates that the calculating mode is 2D.
static int CALC_MODE_3D
          Indicates that the calculating mode is 3D.
static int CALC_MODE_NONE
          Indicates that there is no calcuating mode set.
protected  int calcMode
          Calculating mode (2D/3D); valid values are CALC_MODE_NONE, CALC_MODE_2D, or CALC_MODE_3D.
protected  boolean dataValid
          Indicates whether or not the current GPS data is valid.
protected  float dgpsAge
           
protected  int dgpsRefStation
           
protected  float geoidHeight
          The altitude of the antenna of the GPS (location where the signals are recieved).
static int GPS_QUAL_DGPS
          Indicates GPS satellite fix + differential signal.
static int GPS_QUAL_GPS
          Indicates GPS satellite fix only.
static int GPS_QUAL_NO
          Indicates no GPS.
protected  int gpsQual
          Quality of GPS data; values will be either GPS_QUAL_NO, GPS_QUAL_GPS, GPS_QUAL_DGPS.
protected  float hdop
          Horizontal Dilution of Precision - approximation of the size of the area in which the actual location of the GPS is horizontally based on the spread of the fixed satellites; higher numbers are worse, smaller mean better precision; this value may range between 1-50.
protected  float heightDiff
          The differential between the elipsoid and the geoid.
protected  double lat
           
protected  double lon
           
protected  int numSats
           
protected  float pdop
          Position Dillution of Precision
protected  float utcPosTime
           
protected  float vdop
          Vertical Dillution of Precision
 
Fields inherited from class ecologylab.xml.ElementState
CDATA, ESTIMATE_CHARS_PER_FIELD, FLOATING_PRECISION_OFF, MARSHALLING_PARAMS, NORMAL, UTF16, UTF16_LE, UTF8, XML_FILE_HEADER
 
Fields inherited from interface ecologylab.xml.OptimizationTypes
BAD_FIELD, COLLECTION_ELEMENT, COLLECTION_SCALAR, IGNORED_ATTRIBUTE, IGNORED_ELEMENT, LEAF_NODE_VALUE, MAP_ELEMENT, MAP_SCALAR, NAME_SPACE_ATTRIBUTE, NAME_SPACE_LEAF_NODE, NAME_SPACE_MASK, NAME_SPACE_NESTED_ELEMENT, NAMESPACE_IGNORED_ELEMENT, NAMESPACE_TRIAL_ELEMENT, OTHER_NESTED_ELEMENT, REGULAR_ATTRIBUTE, REGULAR_NESTED_ELEMENT, ROOT, UNSET_TYPE, XMLNS_ATTRIBUTE, XMLNS_IGNORED
 
Fields inherited from interface ecologylab.xml.XMLTranslationExceptionTypes
FILE_NOT_FOUND, IO_EXCEPTION, NULL_PURL, UNKNOWN
 
Constructor Summary
GPSDatum()
           
GPSDatum(double latDeg, double lonDeg)
           
GPSDatum(double latDeg, double latMin, double lonDeg, double lonMin)
           
 
Method Summary
 void addGPSDataUpdatedListener(GPSDataUpdatedListener l)
           
 double compareEW(GPSDatum that)
           
 double compareNS(GPSDatum that)
           
 double getLat()
           
 double getLon()
           
 java.awt.geom.Point2D.Double getPointRepresentation()
          Gets the latitude and longitude of this datum as a Point2D, where x = longitude and y = latitude.
 void integrateGPSData(java.lang.String gpsData)
          Splits and stores data from an NMEA GPS data set.
static void main(java.lang.String[] args)
           
 void setLat(double lat)
           
 void setLon(double lon)
           
 java.lang.String toString()
           
protected  ArrayListState<SVData> trackedSVs()
           
 void updateAutoCalcMode(java.lang.String src)
           
 void updateCalcMode(java.lang.String src)
           
 void updateDataValid(java.lang.String src)
           
 void updateDGPSAge(java.lang.String src)
           
 void updateDGPSRef(java.lang.String src)
           
 void updateDiffHeightUnit(java.lang.String src)
           
 void updateGeoidHeight(java.lang.String src)
           
 void updateGPSQual(java.lang.String src)
           
 void updateHDOP(java.lang.String src)
           
 void updateHeightDiff(java.lang.String src)
           
 void updateHeightUnit(java.lang.String src)
           
 void updateLat(java.lang.String src)
          determine latitude degrees and minutes
 void updateLatHemisphere(java.lang.String src)
          determine latitude sign
 void updateLon(java.lang.String src)
          determine longitude degress and minutes
 void updateLonHemisphere(java.lang.String src)
          determine longitude sign
 void updateNumSats(java.lang.String src)
           
 void updatePDOP(java.lang.String src)
           
 void updateSV(java.lang.String src, int i)
          Specifies the SV number to be added to the list of tracked SVs.
 void updateUtcPosTime(java.lang.String src)
           
 void updateVDOP(java.lang.String src)
           
 
Methods inherited from class ecologylab.xml.ElementState
addNestedElement, addNestedElement, appendTextNodeString, buildDOM, buildDOM, buildDOM, buildDOM, buildDOM, buildDOMFromXMLCharSequence, buildDOMFromXMLString, checkAnnotation, convertNameStyles, createChildHook, fieldToXMLOptimizations, floatingPrecision, getCollection, getElementStateById, getMap, getNestedNameSpace, getTextNodeString, leafElementFieldNames, lookupNestedNameSpace, optimizations, parent, postTranslationProcessingHook, preTranslationProcessingHook, recycle, setDeclarationStyle, setFieldUsingTypeRegistry, setFloatingPrecision, setParent, setUseDOMForTranslateTo, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXMLCharSequence, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOMCharSequence, translateFromXMLDOMCharSequence, translateFromXMLRootNode, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateToDOM, translateToXML, translateToXML, translateToXML, translateToXML, writePrettyXML, writePrettyXML, writePrettyXML
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GPS_QUAL_NO

public static final int GPS_QUAL_NO
Indicates no GPS.

See Also:
Constant Field Values

GPS_QUAL_GPS

public static final int GPS_QUAL_GPS
Indicates GPS satellite fix only.

See Also:
Constant Field Values

GPS_QUAL_DGPS

public static final int GPS_QUAL_DGPS
Indicates GPS satellite fix + differential signal.

See Also:
Constant Field Values

CALC_MODE_NONE

public static final int CALC_MODE_NONE
Indicates that there is no calcuating mode set.

See Also:
Constant Field Values

CALC_MODE_2D

public static final int CALC_MODE_2D
Indicates that the calculating mode is 2D.

See Also:
Constant Field Values

CALC_MODE_3D

public static final int CALC_MODE_3D
Indicates that the calculating mode is 3D.

See Also:
Constant Field Values

utcPosTime

protected float utcPosTime

lat

protected double lat

lon

protected double lon

gpsQual

protected int gpsQual
Quality of GPS data; values will be either GPS_QUAL_NO, GPS_QUAL_GPS, GPS_QUAL_DGPS.


numSats

protected int numSats

hdop

protected float hdop
Horizontal Dilution of Precision - approximation of the size of the area in which the actual location of the GPS is horizontally based on the spread of the fixed satellites; higher numbers are worse, smaller mean better precision; this value may range between 1-50. According to http://www.codepedia.com/1/Geometric+Dilution+of+Precision+(DOP):
DOP Rating Description
1 Ideal This is the highest possible confidence level to be used for applications demanding the highest possible precision at all times.
2-3 Excellent At this confidence level, positional measurements are considered accurate enough to meet all but the most sensitive applications.
4-6 Good Represents a level that marks the minimum appropriate for making business decisions. Positional measurements could be used to make reliable in-route navigation suggestions to the user.
7-8 Moderate Positional measurements could be used for calculations, but the fix quality could still be improved. A more open view of the sky is recommended.
9-20 Fair Represents a low confidence level. Positional measurements should be discarded or used only to indicate a very rough estimate of the current location.
21-50 Poor At this level, measurements are inaccurate by half a football field or more and should be discarded.


pdop

protected float pdop
Position Dillution of Precision


vdop

protected float vdop
Vertical Dillution of Precision


geoidHeight

protected float geoidHeight
The altitude of the antenna of the GPS (location where the signals are recieved). In meters.


heightDiff

protected float heightDiff
The differential between the elipsoid and the geoid. In meters.


dgpsAge

protected float dgpsAge

dgpsRefStation

protected int dgpsRefStation

dataValid

protected boolean dataValid
Indicates whether or not the current GPS data is valid.


autoCalcMode

protected boolean autoCalcMode
Indicates whether or not the calculation mode (2D/3D) is automatically selected.


calcMode

protected int calcMode
Calculating mode (2D/3D); valid values are CALC_MODE_NONE, CALC_MODE_2D, or CALC_MODE_3D.


allSVs

protected java.util.HashMap<java.lang.Integer,SVData> allSVs
All up-to-date data on SVs that have been reported by the GPS hardware.

Constructor Detail

GPSDatum

public GPSDatum()

GPSDatum

public GPSDatum(double latDeg,
                double latMin,
                double lonDeg,
                double lonMin)

GPSDatum

public GPSDatum(double latDeg,
                double lonDeg)
Method Detail

compareNS

public double compareNS(GPSDatum that)
Parameters:
that -
Returns:
positive if this is farther north than that, negative if that is more north; 0 if they lie on exactly the same parallel.

compareEW

public double compareEW(GPSDatum that)
Parameters:
that -
Returns:
compares two GPSDatum's based on the acute angle between their longitudes. Returns 1 if this is farther east than that, -1 if this is farther west, 0 if the two points lie on the same arc, 180/-180 if they are opposite.

main

public static void main(java.lang.String[] args)

integrateGPSData

public void integrateGPSData(java.lang.String gpsData)
Splits and stores data from an NMEA GPS data set.

Parameters:
gpsData - a GPS data set, minus $ header and trailer.

toString

public java.lang.String toString()
Overrides:
toString in class Debug

updateLonHemisphere

public void updateLonHemisphere(java.lang.String src)
determine longitude sign

Parameters:
src -

updateLon

public void updateLon(java.lang.String src)
determine longitude degress and minutes

Parameters:
src -

updateLatHemisphere

public void updateLatHemisphere(java.lang.String src)
determine latitude sign

Parameters:
src -

updateLat

public void updateLat(java.lang.String src)
determine latitude degrees and minutes

Parameters:
src -

updateUtcPosTime

public void updateUtcPosTime(java.lang.String src)
Parameters:
src -

updateNumSats

public void updateNumSats(java.lang.String src)
Parameters:
src -

updateGPSQual

public void updateGPSQual(java.lang.String src)
Parameters:
src -

updateDGPSRef

public void updateDGPSRef(java.lang.String src)
Parameters:
src -

updateDiffHeightUnit

public void updateDiffHeightUnit(java.lang.String src)
Parameters:
src -

updateDGPSAge

public void updateDGPSAge(java.lang.String src)
Parameters:
src -

updateHeightUnit

public void updateHeightUnit(java.lang.String src)
Parameters:
src -

updateGeoidHeight

public void updateGeoidHeight(java.lang.String src)
Parameters:
src -

updateDataValid

public void updateDataValid(java.lang.String src)

updateAutoCalcMode

public void updateAutoCalcMode(java.lang.String src)
Parameters:
src -

updateCalcMode

public void updateCalcMode(java.lang.String src)
Parameters:
src -

updateSV

public void updateSV(java.lang.String src,
                     int i)
Specifies the SV number to be added to the list of tracked SVs. Because NMEA sentences report data on up to 12 tracked SVs, each SV has an index (in addition to its ID).

Parameters:
src - the data String containing the ID of the tracked SV.
i - the index of the tracked SV (will overwrite whichever was stored previously).

updateHDOP

public void updateHDOP(java.lang.String src)
Parameters:
src -

updatePDOP

public void updatePDOP(java.lang.String src)
Parameters:
src -

updateVDOP

public void updateVDOP(java.lang.String src)
Parameters:
src -

updateHeightDiff

public void updateHeightDiff(java.lang.String src)
Parameters:
src -

getLat

public double getLat()
Returns:
the lat

getLon

public double getLon()
Returns:
the lon

setLat

public void setLat(double lat)
Parameters:
lat - the lat to set

setLon

public void setLon(double lon)
Parameters:
lon - the lon to set

getPointRepresentation

public java.awt.geom.Point2D.Double getPointRepresentation()
Gets the latitude and longitude of this datum as a Point2D, where x = longitude and y = latitude.

Returns:
the pointRepresentation

addGPSDataUpdatedListener

public void addGPSDataUpdatedListener(GPSDataUpdatedListener l)

trackedSVs

protected ArrayListState<SVData> trackedSVs()