public class GpsData extends LatLong implements java.lang.Cloneable
Position data stores a latitude, longitude, height, heading, pitch and roll. These are the 6 essentially bits of information which allow for the position of an object to be described with reference to the planet. All, some or none of these fields can be stored in this class.
PositionData also stores useful functions for predicting position and decoding position data e.g. NMEA.
For reference the Euler angle convention in PAMGUARD is as follows.
Heading- 0==north, 90==east 180=south, 270==west
Pitch- 90=-g, 0=0g, -90=g i.e. pointing downwards is -90, level is 0 and pointing upwards is 90
Tilt 0->180 -camera turning towards left to upside down 0->-180 camera turning right to upside down
All angles are in DEGREES. //TODO- this should be radians:
Modifier and Type | Field and Description |
---|---|
static double |
METERSPERMILE |
deg, FORMAT_DECIMALMINUTES, FORMAT_MINUTESSECONDS, MetersPerMile
Constructor and Description |
---|
GpsData() |
GpsData(double latitude,
double longitude,
double height,
double heading,
double pitch,
double roll,
long timeInMillis) |
GpsData(double latitude,
double longitude,
double speed,
double courseOverGround,
long timeInMillis,
java.lang.Double trueHeading,
java.lang.Double magneticHeading)
Constructor used in viewer and Mixed Mode
|
GpsData(double latitude,
double longitude,
double height,
long timeInMillis)
Used for buoy data received over the network.
|
GpsData(LatLong latLong)
Sonctructor to create a GPSData object from a lat long.
|
GpsData(java.lang.StringBuffer nmeaString,
int stringType,
boolean isGlobal) |
Modifier and Type | Method and Description |
---|---|
GpsData |
clone() |
static GpsData |
getAverage(GpsData gpsData1,
GpsData gpsData2) |
double |
getCourseOverGround()
Return the course over ground from the GPS.
|
int |
getDate() |
double |
getDistanceFromLast() |
double[] |
getEulerAngles()
Get the Euler angles which describe the rotation of this position.
|
java.util.Calendar |
getGpsCalendar() |
double |
getHeading()
Gets the best available data on the vessels true heading.
|
java.lang.Double |
getHeading(boolean noGPSCourse)
Gets the best available data on the vessels true heading.
|
int |
getHours()
Get hours from NMEA date, not system time
|
java.lang.Double |
getMagneticHeading() |
java.lang.Double |
getMagneticVariation() |
int |
getMillis()
Get seconds from NMEA date, not system time
|
int |
getMins()
Get minutes from NMEA date, not system time
|
double |
getPitch()
Get the pitch value, returning 0 if it's null.
|
java.lang.Double |
getPitchD()
Hydrophone pitch in degrees, +ve means that the front
of the hydrophone is up, -ve is down.
|
GpsData |
getPredictedGPSData(long predictionTime) |
GpsData |
getPredictedGPSData(long predictionTime,
long maxInterpMillis)
Predict where the gps position will be at a given time
based on the current speed and heading, but interpolating to some maximum
amount.
|
PamQuaternion |
getQuaternion()
Get the quaternion which describe the rotation of this position.
|
double |
getRoll() |
java.lang.Double |
getRollD()
Hydrophone roll in degrees, +ve is roll to the left, -ve to the right.
|
int |
getSecs()
Get seconds from NMEA date, not system time
|
double |
getSpeed()
Returns the speed in knots
|
double |
getSpeedMetric()
Gets the speed in metres per second
|
int |
getTime() |
long |
getTimeInMillis() |
java.lang.Double |
getTrueHeading() |
java.lang.String |
gpsDataToGGA(int nDecPlaces) |
java.lang.String |
gpsDataToRMC(int nDecPlaces) |
boolean |
isDataOk() |
void |
printGpsValues() |
void |
setCourseOverGround(double courseOverGround) |
void |
setDataOk(boolean dataOk) |
void |
setDate(int date) |
void |
setEulerAngles(double[] angles)
Set the Euler angles which describe the rotation of this position.
|
void |
setGpsCalendar(java.util.Calendar gpsCalendar) |
void |
setMagneticHeading(java.lang.Double magneticHeading) |
void |
setMagneticVariation(java.lang.Double magneticVariation) |
void |
setPitch(java.lang.Double pitch)
Hydrophone pitch in degrees, +ve means that the front
of the hydrophone is up, -ve is down.
|
void |
setRoll(java.lang.Double roll)
Hydrophone roll in degrees, +ve is roll to the left, -ve to the right.
|
void |
setSpeed(double speed) |
void |
setTime(int time) |
void |
setTimeInMillis(long timeInMillis) |
void |
setTrueHeading(java.lang.Double trueHeading) |
java.lang.String |
toFullString() |
addDistanceMeters, bearingTo, distanceToMetres, distanceToMetresX, distanceToMetresY, distanceToMiles, doubleDegrees2StringDegs, doubleDegrees2StringMins, equals, formatLatitude, formatLatitude, formatLongitude, formatLongitude, getCrossTrackError, getDataFlavor, getDecimalMinutes, getFormatStyle, getHeight, getIntegerMinutes, getLatitude, getLongitude, getMean, getPastedValue, getSeconds, getSignedDegrees, getTransferData, getTransferDataFlavors, isDataFlavorSupported, setFormatStyle, setHeight, setLatitude, setLongitude, toString, travelDistanceMeters, TravelDistanceMiles, valueOfString, valueOfSubstring
public static final double METERSPERMILE
public GpsData()
public GpsData(LatLong latLong)
latLong
- latlong object.public GpsData(double latitude, double longitude, double speed, double courseOverGround, long timeInMillis, java.lang.Double trueHeading, java.lang.Double magneticHeading)
latitude
- latitudelongitude
- longitudespeed
- speed (knots)courseOverGround
- course over groundtimeInMillis
- java millisecond timetrueHeading
- true headingmagneticHeading
- magnetic headingpublic GpsData(double latitude, double longitude, double height, long timeInMillis)
latitude
- longitude
- timeInMillis
- public GpsData(double latitude, double longitude, double height, double heading, double pitch, double roll, long timeInMillis)
latitude-
- latitudelongitude-longitude
- height
- - heightheading
- - true heading in DEGREESpitch
- - pitch in DEGREESroll
- - roll in DEGRESStimeInMillis
- time in millis.public GpsData(java.lang.StringBuffer nmeaString, int stringType, boolean isGlobal)
public java.lang.String gpsDataToRMC(int nDecPlaces)
public java.lang.String gpsDataToGGA(int nDecPlaces)
public void printGpsValues()
public long getTimeInMillis()
public java.util.Calendar getGpsCalendar()
public int getDate()
public double getHeading()
public java.lang.Double getHeading(boolean noGPSCourse)
noGPSCourse
- set true if you only want courses from proper heading sensors.
If noGPSSource is true and gyro or fluxgate data are unavailable null will be
returned.public java.lang.Double getTrueHeading()
public void setTrueHeading(java.lang.Double trueHeading)
trueHeading
- the trueHeading to setpublic void setMagneticHeading(java.lang.Double magneticHeading)
magneticHeading
- the magneticHeading to setpublic java.lang.Double getMagneticHeading()
public double getCourseOverGround()
public void setCourseOverGround(double courseOverGround)
courseOverGround
- the courseOverGround to setpublic double getSpeed()
public double getSpeedMetric()
public int getTime()
public void setSpeed(double speed)
public int getHours()
public java.lang.Double getMagneticVariation()
public void setMagneticVariation(java.lang.Double magneticVariation)
magneticVariation
- the magneticVariation to setpublic int getMins()
public int getSecs()
public int getMillis()
public void setDate(int date)
public void setGpsCalendar(java.util.Calendar gpsCalendar)
public void setTime(int time)
public void setTimeInMillis(long timeInMillis)
public double getDistanceFromLast()
public boolean isDataOk()
public void setDataOk(boolean dataOk)
public GpsData getPredictedGPSData(long predictionTime)
public GpsData getPredictedGPSData(long predictionTime, long maxInterpMillis)
predictionTime
- time of predictionmaxInterpMillis
- max milliseconds to interpolate.public java.lang.Double getPitchD()
public double getPitch()
public void setPitch(java.lang.Double pitch)
pitch
- the pitch to setpublic java.lang.Double getRollD()
public double getRoll()
public void setRoll(java.lang.Double roll)
roll
- the roll to setpublic double[] getEulerAngles()
public PamQuaternion getQuaternion()
public void setEulerAngles(double[] angles)
angles-Euler
- angles [heading, pitch, roll] in Degrees. See class description for angle conventionspublic java.lang.String toFullString()