Class DexterGPSSensor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.DexterGPSSensor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class DexterGPSSensor extends I2CSensor
Dexter dGPS sensor
Sends GPS coordinates to your robot and calculates navigation informationThe 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 thelinkStatus()method.See Sensor datasheet See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Mark Crosbie
-
-
Field Summary
Fields Modifier and Type Field Description static byteDGPS_CMD_ANGDstatic byteDGPS_CMD_ANGRstatic byteDGPS_CMD_DISTstatic byteDGPS_CMD_HEADstatic byteDGPS_CMD_LATstatic byteDGPS_CMD_LONGstatic byteDGPS_CMD_SLATstatic byteDGPS_CMD_SLONGstatic byteDGPS_CMD_STATUSstatic byteDGPS_CMD_UTCstatic byteDGPS_CMD_VELOstatic byteDGPS_I2C_ADDR-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
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 Summary
Constructors Constructor Description DexterGPSSensor(I2CPort i2cPort)ConstructorDexterGPSSensor(Port sensorPort)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleProvidergetAngleMode()Dexter dGPS sensor, Angle mode
Gets the heading of the sensorSampleProvidergetPositionMode()Dexter dGPS sensor, Position mode
Gets the coordinates of the sensorSampleProvidergetTimeMode()Dexter dGPS sensor, Time mode
gets the UTC time from the sensorSampleProvidergetVelocityMode()Dexter dGPS sensor, Velocity mode
Gets the velocity (speed) of the sensorprotected voidinit()booleanlinkStatus()Return status of link to the GPS satellites LED on dGPS should light if satellite lock acquired-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
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
-
-
Method Detail
-
init
protected void init()
-
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
-
getPositionMode
public SampleProvider getPositionMode()
Dexter dGPS sensor, Position mode
Gets the coordinates of the sensorSize 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)whereD=77,M=2, andS=54.79. For the given values, the formula yields the integer value 77048553. Basically, this is equivalent to decimal degrees times a million.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
getAngleMode
public SampleProvider getAngleMode()
Dexter dGPS sensor, Angle mode
Gets the heading of the sensorSize 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.- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
getVelocityMode
public SampleProvider getVelocityMode()
Dexter dGPS sensor, Velocity mode
Gets the velocity (speed) of the sensorSize and content of the sample
The sample contains one elements giving the speed of the sensor (in metres/second).- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
getTimeMode
public SampleProvider getTimeMode()
Dexter dGPS sensor, Time mode
gets the UTC time from the sensorSize and content of the sample
The sample contains one elements representing the UTC time (hhmmss) .- Returns:
- A sampleProvider
See
leJOS conventions for SampleProvidersSee Sensor datasheet
-
-