lejos.nxt.addon
Class GPSSensor

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.GPSSensor
All Implemented Interfaces:
SensorConstants

public class GPSSensor
extends I2CSensor

Class for controlling dGPS sensor from Dexter Industries

Author:
Mark Crosbie 22 January, 2011

Field Summary
static byte DGPS_CMD_ANGD
           
static byte DGPS_CMD_ANGR
           
static byte DGPS_CMD_DIST
           
static byte DGPS_CMD_HEAD
           
static byte DGPS_CMD_LAT
           
static byte DGPS_CMD_LONG
           
static byte DGPS_CMD_SLAT
           
static byte DGPS_CMD_SLONG
           
static byte DGPS_CMD_STATUS
           
static byte DGPS_CMD_UTC
           
static byte DGPS_CMD_VELO
           
static byte DGPS_I2C_ADDR
           
 
Fields inherited from class lejos.nxt.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_SENSOR_TYPE, REG_VERSION
 
Fields inherited from interface lejos.nxt.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
 
Constructor Summary
GPSSensor(I2CPort sensorPort)
          Constructor
 
Method Summary
 int getAngleToDest()
          Angle to destination in degrees
 int getDistanceToDest()
          Distance to destination in meters
 int getHeading()
          Read the current heading in degrees
 int getLat()
          Read the current latitude in degrees (positive=North, negative=South)
 int getLong()
          Read the current longitude in degrees (positive=East, negative=West)
 int getRelativeHeading()
          Read the current relative heading in degrees Angle travelled since last request.
 int getUTC()
          Get the current time stored on the dGPS
 int getVelocity()
          Read the current velocity in cm/s
 boolean linkStatus()
          Return status of link to the GPS satellites LED on dGPS should light if satellite lock acquired
 int setLatitude(int latitude)
          Set destination latitude coordinates
 int setLongitude(int longitude)
          Set destination longitude coordinates
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getData, getData, getData, getId, getProductID, getSensorType, getVersion, sendData, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DGPS_I2C_ADDR

public static final byte DGPS_I2C_ADDR
See Also:
Constant Field Values

DGPS_CMD_UTC

public static final byte DGPS_CMD_UTC
See Also:
Constant Field Values

DGPS_CMD_STATUS

public static final byte DGPS_CMD_STATUS
See Also:
Constant Field Values

DGPS_CMD_LAT

public static final byte DGPS_CMD_LAT
See Also:
Constant Field Values

DGPS_CMD_LONG

public static final byte DGPS_CMD_LONG
See Also:
Constant Field Values

DGPS_CMD_VELO

public static final byte DGPS_CMD_VELO
See Also:
Constant Field Values

DGPS_CMD_HEAD

public static final byte DGPS_CMD_HEAD
See Also:
Constant Field Values

DGPS_CMD_DIST

public static final byte DGPS_CMD_DIST
See Also:
Constant Field Values

DGPS_CMD_ANGD

public static final byte DGPS_CMD_ANGD
See Also:
Constant Field Values

DGPS_CMD_ANGR

public static final byte DGPS_CMD_ANGR
See Also:
Constant Field Values

DGPS_CMD_SLAT

public static final byte DGPS_CMD_SLAT
See Also:
Constant Field Values

DGPS_CMD_SLONG

public static final byte DGPS_CMD_SLONG
See Also:
Constant Field Values
Constructor Detail

GPSSensor

public GPSSensor(I2CPort sensorPort)
Constructor

Parameters:
sensorPort - the sensor port the sensor is connected to
Method Detail

linkStatus

public boolean linkStatus()
Return status of link to the GPS satellites LED on dGPS should light if satellite lock acquired

Returns:
true if GPS link is up, else false

getUTC

public int getUTC()
Get the current time stored on the dGPS

Returns:
current UTC time stored on the device

getLat

public int getLat()
Read the current latitude in degrees (positive=North, negative=South)

Returns:
current latitude in decimal degrees

getLong

public int getLong()
Read the current longitude in degrees (positive=East, negative=West)

Returns:
current longitude in decimal degrees

getVelocity

public int getVelocity()
Read the current velocity in cm/s

Returns:
current velocity in cm/s

getHeading

public int getHeading()
Read the current heading in degrees

Returns:
current heading in degrees

getRelativeHeading

public int getRelativeHeading()
Read the current relative heading in degrees Angle travelled since last request. See dGPS manual.

Returns:
relative head

getDistanceToDest

public int getDistanceToDest()
Distance to destination in meters

Returns:
distance to destination in meters

getAngleToDest

public int getAngleToDest()
Angle to destination in degrees

Returns:
angle to destination in degrees

setLatitude

public int setLatitude(int latitude)
Set destination latitude coordinates

Parameters:
latitude - destination's latitude in decimal degrees
Returns:
0 if no error else error code

setLongitude

public int setLongitude(int longitude)
Set destination longitude coordinates

Parameters:
longitude - destination's longitude in decimal degrees
Returns:
0 if no error else error code