JMU JMU - Department of Computer Science
Help Tools
PA6: Location/Position Determination


Never use a computer while driving. Only test your code in a moving vehicle when you are a passenger.

1 Purpose

The primary purpose of this assignment is to help you review (and demonstrate that you have acquired) the knowledge and skills required to work with GPS receivers and to display location information on a map.

2 Overview

Nearby is a (fictitious) company that develops personal navigation systems, en-route and mobile commerce systems, location-based services, and geographic tracking/location services. They are in the process of developing a personal navigation system called Way. They have hired you to construct several interfaces/classes that can be used to add GPS-related capabilities to their current navigation system.

3 Design Document

Nearby has provided you with the following design document:

(They have also provided you with an SVG version of the engineering design which can be enlarged in most browsers. It is named design.svg.)

4 Before Starting

4.1 Changes to Existing Code

You may want to change the visibility of the zoomStack and displayTransform to protected so that you have access to them in the DynamicCartographyPanel class.

4.2 Installing the Serial Port Library

You must download the serial port library from:

jSerialComm

You should download the jar file to your downloads directory for this course. Do not download it directly into your Eclipse workspace or folders/directories.

After downloading it, right-click on the appropriate project in Eclipse, pull down to [Build Path] and over to [Configure build path...]. Then, select the [Libraries] tab, click on "Classpath", click on [Add External JARs...], and navigate to the .jar file.

The classes are in the package com.fazecast.jSerialComm.

5 Testing

You should write unit tests for the graph package, but you are not required to do so.

You should perform integration testing on the components that you write for reading from a GPS receiver. Nearby has provided you with the following classes for this purpose.

You must perform system testing on all of the components you write. Nearby has provided you with the following classes that you can use for this purpose.

They have also provide you with a GPS simulator and data file that you can use for both integration and system testing.

To use the simulator, replace the code in the "app" that gets the appropriate serial port and gets its InputStream with the following:

    GPSSimulator gps = new GPSSimulator("rockingham.gps");
    InputStream is = gps.getInputStream();
  

6 Submission

You must submit (to the PA6_Java assignment on Gradescope) a .zip file named pa6.zip that contains all of the code necessary to run PA6Driver.java and test you code (packaged appropriately). It must not contain any data files. There is no limit on the number of submissions and no penalty for excessive submissions.

You must submit (to the PA6_Screenshot assignment on Gradescope) a .pdf file that contains a screenshot of your solution while it is displaying a GPS location.

7 Grading

You will receive one of four grades on this assignment -- 100, 75, 50, or 0. You will receive a grade of 100 if your code is essentially correct (i.e., there are a small number of defects). You will receive a grade of 75 if you appear to have devoted significant effort to the assignment but your code has significant defects. You will receive a grade of 50 if you devoted a reasonable amount of effort to the assignment but your code has doesn't really work. You will receive a grade of 0 otherwise and/or if the code you submit to Gradescope contains any style defects.

The Gradescope autograder will assign a maximum grade of 25 (based solely on style). Points will then be awarded manually based on the criteria discussed in the previous paragraph.

8 Help

The following information might be helpfulf if you have problems.

8.1 Help Locating the Serial Port

You will need to determine the port that the GPS receiver is using. Once you have installed the jSerialComm library, you can do this programmatically as follows:
    SerialPort[] ports = SerialPort.getCommPorts();
    for (SerialPort port:ports)
    {
      String description = port.getPortDescription();
      String path = port.getSystemPortPath();
      System.out.println(description + "\t" + path);
    }
    

You can then write some code that will automatically find the path (which may change) based on the description (which won't change).

You can also list your devices both before and after you insert the GPS receiver and look for the differences. In MS-Windows this can be done by opening the [Device Manager] and expanding the entry for [Ports (COM & LPT)]. In Linux you can do this by listing the contents of /dev/.

8.2 Getting an InputStream for the GPS Receiver

Once you have determined the path to the GPS receiver, you can get an InputStream to read from using the jSerialComm library as follows:
    SerialPort gps = SerialPort.getCommPort(gpsPath); 
    gps.openPort();
    gps.setComPortTimeouts(SerialPort.TIMEOUT_READ_SEMI_BLOCKING, 0, 0);
    InputStream is = gps.getInputStream();
    

8.3 Help with Permissions

If you are using Linux and get an error about "the device being closed" or "insufficient permissions" when you try to use it you will need to change permissions. For example, if the device is ttyACMO:
    sudo chmod a+rw /dev/ttyACM0
    

This should not be a problem under MS-Windows if you wait until after the install process completes when you insert the GPS receiver.

8.4 Template Parameters

A template parameter can be bound to the class Void. Methods that return such a template parameter must be declared to return Void and must actually return null.

Copyright 2025