gpsfeed+

Why would one need a gps simulator?

Testing GPS applications requires a gps receiver and an antenna in a position to receive the satellite signals. This, however, is rarely the case when doing software testing at a computer's keyboard. This is where gpsfeed+ can be of help.

The application

gpsfeed+ is a utility that feeds the PC with continuous GPS data as if a GPS were moving in a car or airplane. NMEA 0183 GPS sentences are sent to the application through a socket (TCP/IP) connection or a UDP multicast message. It also outputs the same NMEA data to a serial port of the PC. Polling applications can query the embedded lightweight http server to obtain gps data either in text form or as an XML data snippet.

The IP connection offers significant advantages over a serial port connection:
  • many applications can connect to one single gps simultaneously
  • remote gps' can be monitored
  • Serial ports can be freed for other uses. In most cases, the only readily available and simple I/O interface is the RS232 connector.
  • and, of course, testing can be done indoors, without any GPS hardware or cabling

gpsfeed+ is in development. Please submit bug reports through the SourceForge bug tracking facilities.

Disclaimer

Coordinates, altitude and other GPS data output by gpsfeed+ are fake and might well be inconsistent.
Similarly, although satellite signal reception data are shown in the output, these are not based on any GPS satellite orbit calculations or anything like that.

 The GPS data provided by gpsfeed+ are calculated by very simple mathematical formulas and the results are just presented in the NMEA 0183 sentence format, so use the program on your own risk.

If by examining the code you feel that you can add a feature you like or you can make it function better, then you are free to do so. Contributing your code will help improve gpsfeed+.

License

gpsfeed+ is free software, written in tcl. It is provided in source code, under the GPL license. Linux and Windows binaries are also provided for the x86 architecture.

Features

gpsfeed+ offers the following functionality:
  • IP output (TCP and UDP)
  • Lightweight http server for web queries
  • Serial port output
  • Serial -to-IP forwarding
  • $GPGGA, $GPRMC, $GPGSV and user defined NMEA 0183 sentences
  • User defined XML replies to web queries
  • Playback of captured NMEA sentence file.
  • Output monitor
  • "No signal" output, when paused
  • Three different simulation track shapes
  • Variable output period
  • "Skip" mode for controlling speed
  • Experimental autozoom mode for detailed viewing of slow movements
  • Configurable onscreen data display
  • Configurable colors
  • Compact mode
  • Many gpsfeed+ instances can run on different ports, simulating a fleet of GPSs

Autozoom

gpsfeed+ features two zoom modes: a fixed zoom all mode, and an experimental autozoom. In autozoom mode (icon ), the zoom level changes automatically, in inverse proportion to the speed of the vehicle; the slower the vehicle moves, the higher the zoom level; the area zoomed becomes smaller and more track detail can be seen. If the vehicle moves faster, the area zoomed becomes larger and less track detail is seen.

The reasoning behind the autozoom mode is simple:

  • the screen surface is limited. At high speed and high zoom, one cannot see what is coming up the next second.
  • at high zoom – high speed, details that are displayed, go by fast; the eye struggles, as it tries to capture them.
  • in gpsfeed+, especially in the spiral shape, the fix may seem stopped (although actually moving) for quite some time

In autozoom, the map is centered on the current fix.

Operation


The toolbar

Simulated gps tracks are calculated around user defined center coordinates and range. gpsfeed+ offers, at the moment, the following track shapes:

  • circle : provides fixes with (relatively) stable velocity while the direction changes continuously.
  • square : provides fixes in 4 constant directions while velocity changes continuously.
  • spiral : provides fixes with velocity and direction changing continuously

The velocity in circle is not absolutely constant because the circle is drawn in Cartesian and not spherical coordinates and is therefore not a circle if drawn on the surface of the earth.

For recorded GPS track operation, files containing captured NMEA 0183 sentences can be played back by gpsfeed+ (configuration panel, Mode pane).

Pressing play a second time (icon ) causes gpsfeed+ to stop outputting valid fixes; NMEA sentences are still sent to the output, however data fields are empty and the "fix" field is set to "V" (i.e. fix data invalid). When in pause mode, the play button momentarily flashes red (icon ) and the fix mark (icon on the map) turns to , indicating the "no signal" condition.

If screen space is precious but gpsfeed+ controls should be present, the compact mode (icon ) minimizes gpsfeed+ so that only the toolbar icons are displayed.

The Monitor panel in the configuration window shows exactly what is being sent to the output. You can use monitor even if you have no connection to an output port of any king. Monitoring output this way may be useful when editing your own NMEA sentences, or if you want to see what is coming in from the serial port in Serial-to-IP forwarding.

The NMEA panel has an option Prevent no signal. gpsfeed+ has been written so that satellite visibility is variable. Although this might never happen in real life, there is a need when testing the GPGSV NMEA sentences to have satellites rising and setting. gpsfeed+ allows a condition where all 32 satellites are visible and also where none of them is visible. The Prevent no signal option simply makes all satellites visible by inverting their elevation if it becomes negative.

The NMEA panel includes the option User defined, together with a text box. If this option is selected, whatever is entered in the textbox, gets output to the ports. Prefixing a word with a ’$’ makes it a variable. If the system knows the variable entered, it will substitute it before it sends the sentence to the output. Otherwise it will consider the sentence in error and will not output anything from that sentence. The available gps variables are evident in the code. Some examples of existing and test sentences are by default present in the NMEA textbox. Relative documentation about the system variables will be made available in the future.

Http server

gpsfeed+ implements a lightweight http server for applications that use GET or POST funtionality to get gps coordinates. Examples of this functionality are the getURL and postURL functions that some SVG implementations offer or the XMLHttpRequest object in various browsers.

To use the http server in gpsfeed+, a free IP port will have to be set. By default this port is set to 80. If port 80 is occupied by another web server, any other free port (e.g. port 81) will do. If you plan to serve also documents (e.g. SVG documents using the getURL or postURL functions to get gps coordinates from the same server), then a root directory, where these documents reside, will also have to be set.

gpsfeed+ http queries have the following syntax:


Default syntax. Using

http://localhost/gpsfeed

will cause a reply in the form

lon=dd.ddd;lat=dd.ddd;alt=dd.ddd;
bear=dd.ddd;speed=dd.ddd;

Specific data query:

http://localhost/gpsfeed?time=;msec=;


Any of the available system variable names, found also in the user defined NMEA sentences, can be used in the query.


XML query:

http://localhost/gpsfeed?type=xml


This will cause a reply using the XML (or, as a matter of fact, anything) that is typed in the XML reply textbox. The system variables used should be denoted by prefixing a ’$’, as in the user defined NMEA sentences.


If you use a non standard port (e.g. port 81):

http://localhost:81/gpsfeed?type=xml


The default content of the XML reply textbox is an example of an XML snippet. A GPX compliant reply can be easily implemented in a similar manner.

Testing

Testing the http server is simple: Start gpsfeed+ and press the play button. Cut and paste a query of the ones shown above to the address bar of a browser and hit enter. The server should reply with the gps data requested.

You can easily test the TCP NMEA output of gpsfeed+ by connecting to it with a web browser (Firefox and IE work. Mozilla doesn’t: it waits forever for the socket to be closed).

Enter the following address to the address bar (assuming TCP/IP port 2222
has been configured):

http://localhost:2222

You will see a welcome connection message and then NMEA sentences will start printing on the page as they come in. The welcome message is only output when using the http protocol to get a connection, i.e. when connecting to gpsfeed+ with a browser.

Minimal (emergency) remote control of gpsfeed+ is provided through the TCP http interface.

Typing:

http://localhost:2222/exit

or

http://your.remote.address:port/exit

in a browser’s address bar, will close gpsfeed+.

A side effect of opening a serial port as a stream is that, if you enter a serial port that does not exist, or any other name in place of a serial port, all output of gpsfeed+ will be dumped to a file with that name. This may be useful in some situations, where the output of gpsfeed+ needs to be inspected afterwards.

To do

  • Random shape.

Known issues

  • Shapes around the poles jump to the other hemisphere. This is normal for this type of map projection.

Port forwarding (old - 2005)

Most GPS receivers come with a serial interface of some sort. None of the popular ones comes ready with an IP interface, so, how is one supposed to connect a gps with a serial interface with an application that has been written to use IP sockets?

To overcome this issue, small software utilities called serial-to-ip port forwarders can be used. One of these utilities, which has been around for many years, is gpsd, written by Emmanuel Mogenet as a part of his gps3d project. You can use gpsd to relay anything that comes into the serial port to a local IP port.

If you are a Windows user, put your gps in NMEA mode, then run the following in a command window, or create a shortcut to gpsd.exe and put the following as target string in its properties:

gpsd.exe -serial COM1 -speed 4800 -port 2222

You can test gpsd’s functionality the same way you test gpsfeed+ with a browser.

gpsfeed+ includes a serial-to-IP forwarder to facilitate monitoring and sharing of serial gps data. However, in production environments, the use of gpsd is recommended, since it is smaller in size and requires less resources for its operation.

There is another very interesting gpsd project,  here, which also discusses a number of technical GPS issues and ideas. There is also a proposal for a new GPSTVP sentence that will include all basic GPS location and motion parameters. gpsfeed+ can simulate this proposal very easily and it includes it as a user defined sentence from version 0.53 on. This gpsd code runs only on Unix (Linux) machines.