Global Positioning System Reference
In-Depth Information
trac rules and caused the accident! A third party (RO) application would
be able to replay the collision in slow motion and analyze it from different
perspectives.
The implementation of a
liveTrace
is pretty straightforward. The trace
is created with the
GPSunit
and the
initialGPSinfo
is added as the first
element. In contrast to a real GPS device, the
GPSunit
is always aware of a
change in motion, which makes the auto mode the easiest implementation.
By adding
GPSinfo
with every change of motion, the trace has optimal com-
pression, since points on a straight line don't add information. However,
there is no point in explicitly adding a live trace thread.
In the context of an external observer a
GPSinfo
is added to the live trace
whenever an external client requests information via a get request, i.e.,
getGPSinfo()
. This should be helpful, when validating internally recorded
data against the externally observed trace|and it forces the
GPSunit
to
mark some points, even if it is moving at constant acceleration.
4.12
Loading a
GPX
File to a
GPStrace
GPS traces can have many different sources (even simulations) and different
formats. Earlier, the NMEA format was introduced with more generic GPS
information than we need. The GPX format introduced in this section is
much more suitable for our purposes and can usually be retrieved directly
from a GPS unit.
Before playing back a GPS trace, it has to be loaded into the unit. In
the development of the code so far, small traces were typed directly into
the
main
methods.However, in order to access real traces stored on the hard
disk, we need to deal with persistence and I/O.
Please execute the method
NMEAconverter.main
; make sure to adapt
the resource path to your environment. Note that some of the existing
files will be overwritten.
The JavaGPS project comes with the small NMEA file
demo.gpslog
which can also be found on the topic's web resources. The
NMEAconverter
was written to read and parse NMEA files, eliminate all sentences except
GPRMC and GPGGA into
HDcastle.nmea
and write a simple text file hold-
ing the relevant GPS information:
HDcastle.csv
.
Since the NMEA converter resides in the default folder, the compiled
class can be placed in any folder and can convert NMEA files via command
line. Note the exception in the main method:
demo.gpslog
Search WWH ::
Custom Search