public class DexterGPSSensor extends I2CSensor
The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes | |||
---|---|---|---|
Mode name | Description | unit(s) | Getter |
Position | Gets the coordinates of the sensor | latitude and longitude | getPositionMode() |
Angle | Gets the heading of the sensor | degrees | getAngleMode() |
Velocity | Gets the velocity (speed) of the sensor | metres/second | getVelocityMode() |
Time | gets the time | UTC (hhmmss) | getTimeMode() |
Sensor configuration
There are no configurable parameters.
The status of the sensor can be checked using the linkStatus()
method.
See Sensor datasheet
See Sensor Product page
See The leJOS sensor framework
See leJOS conventions for SampleProviders
Modifier and Type | Field and Description |
---|---|
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 |
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, 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 and Description |
---|
DexterGPSSensor(I2CPort i2cPort)
Constructor
|
DexterGPSSensor(Port sensorPort)
Constructor
|
Modifier and Type | Method and Description |
---|---|
SampleProvider |
getAngleMode()
Dexter dGPS sensor, Angle mode
Gets the heading of the sensor |
SampleProvider |
getPositionMode()
Dexter dGPS sensor, Position mode
Gets the coordinates of the sensor |
SampleProvider |
getTimeMode()
Dexter dGPS sensor, Time mode
gets the UTC time from the sensor |
SampleProvider |
getVelocityMode()
Dexter dGPS sensor, Velocity mode
Gets the velocity (speed) of the sensor |
protected void |
init() |
boolean |
linkStatus()
Return status of link to the GPS satellites LED on dGPS should light if satellite lock acquired
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
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
public DexterGPSSensor(I2CPort i2cPort)
i2cPort
- the i2c port the sensor is connected topublic DexterGPSSensor(Port sensorPort)
sensorPort
- the sensor port the sensor is connected toprotected void init()
public boolean linkStatus()
public SampleProvider getPositionMode()
Size and content of the sample
The sample contains 2 elements. The first element is latitude, the second longitude.
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.
leJOS conventions for SampleProviders
See Sensor datasheet public SampleProvider getAngleMode()
Size and content of the sample
The sample contains one element representing the heading (in degrees) of the sensor. Accurate heading information can only be given when the sensor is in motion.
leJOS conventions for SampleProviders
See Sensor datasheet public SampleProvider getVelocityMode()
Size and content of the sample
The sample contains one elements giving the speed of the sensor (in metres/second).
leJOS conventions for SampleProviders
See Sensor datasheet public SampleProvider getTimeMode()
Size and content of the sample
The sample contains one elements representing the UTC time (hhmmss) .
leJOS conventions for SampleProviders
See Sensor datasheet