public abstract class TelemetryFileTranslator extends Object implements TelemetryTranslatorInterface
Superclass for most robot telemetry parsers that produces AVCL telemetry. The TelemetryTranslatorInterface is the interface, but doesn't reuse code. This class is a useful place for storing some common utility methods and instance variables
Modifier and Type | Field and Description |
---|---|
protected AVCL |
avclDocument |
protected GeodeticToUTMConverter |
centerCoordUTM |
protected ObjectFactory |
factory
Creates new JAXB objects
|
protected AvclTelemetryFileWriter |
fileWriter
File writer, sends telemetry events to an AVCL file
|
protected boolean |
filterOnTime
Should we filter on time at all?
|
protected FileInputStream |
fis
File we read "original format" data from before translating it into avcl.
|
protected com.bbn.openmap.LatLonPoint |
geoOriginLatLon |
protected com.bbn.openmap.LatLonPoint |
latLonOffset |
protected MetaDataModel |
metadata |
protected GeodeticToUTMConverter |
offsetCoordUTM |
protected String |
pathname
Pathname to the input file
|
protected com.bbn.openmap.LatLonPoint |
projectGeoOriginLatLon |
protected PrintStream |
sysoutPW |
protected double |
timeFilterMinimum
The periodicity at which we filter observations.
|
GEO_ORIGIN
Constructor and Description |
---|
TelemetryFileTranslator() |
Modifier and Type | Method and Description |
---|---|
void |
addMetadataEntry(String metadataName,
String metadataValue)
Used to add a new single metadata model to the list in the Metadata
|
void |
endDocument()
implements TelemetryTranslatorInterface
|
AVCL |
getAvclDocument() |
AVCL |
getDefaultAvclDocument()
Creates a mostly-filled-out
AVCL document that lacks only the telemetry data. |
int |
getImportStartTime()
Retrieves a desired start time
|
int |
getImportStopTime()
Retrieves a desired stop time
|
protected String |
getMonthName(int month)
Returns the name of a month
|
protected double |
getSignificantDigits(double input,
int digitsToRight)
Given a floating point/double number, sets the number of significant
digits to the right of the decimal point as specified.
|
PrintStream |
getSysOut() |
double |
getTelemetrySampleRate()
Accept data no more frequently than this
|
double |
getTimeFilterMinimum() |
protected float[] |
latLongToXY()
This conversion solution takes into account a WGS-84 ellipsoid when
calculating (x, y) offsets in meters from a given GeoOrigin.
|
protected Point2D |
latLongToXY(com.bbn.openmap.LatLonPoint geoOrigin,
com.bbn.openmap.LatLonPoint location)
Dragons be here.
|
abstract void |
parse()
required method
|
void |
setFilterOnTime(boolean onTime) |
void |
setImportStartTime(int time)
Sets a desired import start time
|
void |
setImportStopTime(int time)
Sets a desired import stop time
|
void |
setInputFileName(String pPathname)
implements TelemetryTranslatorInterface
|
void |
setMetadata(MetaDataModel metadata) |
void |
setSysOut(PrintStream printStream)
Provides a convenient sysout redirect feature to the output console
|
void |
setTimeFilterMinimum(double frequency) |
void |
startDocument()
implements TelemetryTranslatorInterface
|
void |
startDocument(AVCL pDoc) |
void |
sysOutPrintln(Object o) |
void |
sysOutPrintln(String s) |
abstract String |
toString()
Returns a string description of the translator, suitable for user
viewing in GUIs.
|
void |
writeOutputFile(String s)
implements TelemetryTranslatorInterface *
|
protected PrintStream sysoutPW
protected FileInputStream fis
protected String pathname
protected AvclTelemetryFileWriter fileWriter
protected com.bbn.openmap.LatLonPoint geoOriginLatLon
protected com.bbn.openmap.LatLonPoint projectGeoOriginLatLon
protected com.bbn.openmap.LatLonPoint latLonOffset
protected GeodeticToUTMConverter centerCoordUTM
protected GeodeticToUTMConverter offsetCoordUTM
protected ObjectFactory factory
protected AVCL avclDocument
protected MetaDataModel metadata
protected double timeFilterMinimum
protected boolean filterOnTime
public void setMetadata(MetaDataModel metadata)
setMetadata
in interface TelemetryTranslatorInterface
metadata
- public void setFilterOnTime(boolean onTime)
setFilterOnTime
in interface TelemetryTranslatorInterface
public void setTimeFilterMinimum(double frequency)
setTimeFilterMinimum
in interface TelemetryTranslatorInterface
public void addMetadataEntry(String metadataName, String metadataValue)
TelemetryTranslatorInterface
addMetadataEntry
in interface TelemetryTranslatorInterface
public void startDocument()
startDocument
in interface TelemetryTranslatorInterface
public void startDocument(AVCL pDoc)
public void endDocument()
endDocument
in interface TelemetryTranslatorInterface
public void writeOutputFile(String s) throws Exception
writeOutputFile
in interface TelemetryTranslatorInterface
s
- Exception
public void setInputFileName(String pPathname) throws Exception
setInputFileName
in interface TelemetryTranslatorInterface
pPathname
- Exception
public AVCL getDefaultAvclDocument()
AVCL
document that lacks only the telemetry data.AVCL
telemetry mission specific to this type of vehiclepublic abstract void parse()
parse
in interface TelemetryTranslatorInterface
protected String getMonthName(int month)
month
- int from 0-11protected Point2D latLongToXY(com.bbn.openmap.LatLonPoint geoOrigin, com.bbn.openmap.LatLonPoint location)
This code is rife with opportunities for being wrong in subtle ways. The open map code is generating a "correct" surface-of-sphere distance between points, while we are acting as if we are in a flat 2D world. So any time the vehicles are operating on a sufficiently large geographic scale, distoritions will start to show up. Note that the docs for LatLonPoint.azimuth and LatLonPoint.distance say they are premised on a spherical earth, vs. an ellipsoid used elsewhere, and that this can result in distance errors of 0.5% or so. If you are expecting exact results for (x, y) from lat/lon, you will be disappointed. Positive x is north, positive y east.
geoOrigin
- the origin of our x-y world, in lat-longlocation
- the lat-long point we want the x-y to beprotected final float[] latLongToXY()
protected double getSignificantDigits(double input, int digitsToRight)
input
- the double to trimdigitsToRight
- max digits to the right of the decimal pointpublic void setSysOut(PrintStream printStream)
setSysOut
in interface TelemetryTranslatorInterface
printStream
- the stream to output to the system consolepublic PrintStream getSysOut()
public void sysOutPrintln(String s)
public void sysOutPrintln(Object o)
public abstract String toString()
TelemetryTranslatorInterface
toString
in interface TelemetryTranslatorInterface
toString
in class Object
public double getTelemetrySampleRate()
getTelemetrySampleRate
in interface TelemetryTranslatorInterface
public double getTimeFilterMinimum()
getTimeFilterMinimum
in interface TelemetryTranslatorInterface
public void setImportStartTime(int time)
TelemetryTranslatorInterface
setImportStartTime
in interface TelemetryTranslatorInterface
time
- a desired import start timepublic int getImportStartTime()
TelemetryTranslatorInterface
getImportStartTime
in interface TelemetryTranslatorInterface
public void setImportStopTime(int time)
TelemetryTranslatorInterface
setImportStopTime
in interface TelemetryTranslatorInterface
time
- a desired import stop timepublic int getImportStopTime()
TelemetryTranslatorInterface
getImportStopTime
in interface TelemetryTranslatorInterface