|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.I2CSensor lejos.nxt.addon.GPSSensor
public class GPSSensor
Class for controlling dGPS sensor from Dexter Industries. Documentation for this sensor can be found at Dexter Industries.
The sensor uses an integer-based representation of latitude and longitude values.
Assume that you want to convert the value of 77 degrees, 2 minutes and 54.79 seconds
to the integer-based representation. The integer value is computed as follows:
R = 1000000 * (D + M / 60 + S / 3600)
where D=77
, M=2
, and S=54.79
.
For the given values, the formula yields the integer value 77048553.
Basically, this is equivalent to decimal degrees times a million.
You can use the standard javax.microedition.location
package with this class by
using a dGPSCriteria
object to request a LocationProvider as follows:
dGPSCriteria criteria = new gGPSCriteria(SensorPort.S1);
LocationProvider lp = LocationProvider.getInstance(criteria);
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_VENDOR_ID, 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 as reported by the GPS chip. |
int |
getLatitude()
Read the current latitude as an integer value (decimal degrees times a million). |
int |
getLongitude()
Read the current longitude as an integer value (decimal degrees times a million). |
int |
getRelativeHeading()
Read the current relative heading in degrees. |
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, getAddress, getData, getData, getPort, getProductID, getVendorID, 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 |
---|
public static final byte DGPS_I2C_ADDR
public static final byte DGPS_CMD_UTC
public static final byte DGPS_CMD_STATUS
public static final byte DGPS_CMD_LAT
public static final byte DGPS_CMD_LONG
public static final byte DGPS_CMD_VELO
public static final byte DGPS_CMD_HEAD
public static final byte DGPS_CMD_DIST
public static final byte DGPS_CMD_ANGD
public static final byte DGPS_CMD_ANGR
public static final byte DGPS_CMD_SLAT
public static final byte DGPS_CMD_SLONG
Constructor Detail |
---|
public GPSSensor(I2CPort sensorPort)
sensorPort
- the sensor port the sensor is connected toMethod Detail |
---|
public boolean linkStatus()
public int getUTC()
public int getLatitude()
Read the current latitude as an integer value (decimal degrees times a million). See here for explanation. positive=North, negative=South.
public int getLongitude()
Read the current longitude as an integer value (decimal degrees times a million). See here for explanation. positive=East, negative=West.
public int getVelocity()
public int getHeading()
public int getRelativeHeading()
Read the current relative heading in degrees. The relative heading is the angle of travel since the last request of this method. The first time this method is called, the GPS coordinates are stored in this chip. The second time it is called it reports the angle between the current coordinates and the coordinates from the previous call.
(See dGPS manual.)
public int getDistanceToDest()
public int getAngleToDest()
public int setLatitude(int latitude)
latitude
- destination's latitude in decimal degrees
public int setLongitude(int longitude)
longitude
- destination's longitude in decimal degrees
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |