public class MindsensorsCompass extends I2CSensor implements Calibrate
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 |
Compass | Measures the orientation of the sensor | Degrees, corresponding to the compass rose | getCompassMode() |
Angle | Measures the orientation of the sensor | Degrees, corresponding to the right hand coordinate system | getAngleMode() |
Sensor configuration
The sensor can be calibrated for magnetic disturbances coming from the robot
(soft iron calibration). Use the startCalibration method to put the sensor in
calibration mode. While in calibration mode the sensor should be rotated
slowly for making 2 full rotations taking at least 20 seconds per turn. Then
end calibration with the endCalibration method.
See
Sensor datasheet
See
Sensor Product page
See The
leJOS sensor framework
See leJOS conventions for
SampleProviders
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 |
---|
MindsensorsCompass(I2CPort port)
Create a compass sensor object
|
MindsensorsCompass(I2CPort port,
int address)
Create a compass sensor object
|
MindsensorsCompass(Port port)
Create a compass sensor object
|
MindsensorsCompass(Port port,
int address)
Create a compass sensor object
|
Modifier and Type | Method and Description |
---|---|
SensorMode |
getAngleMode()
MindSensors compass sensor, Angle mode
Measures the bearing of the sensor. |
SensorMode |
getCompassMode()
Mindsensors compass sensor, Compass mode
Measures the bearing of the sensor. |
protected void |
init() |
void |
startCalibration()
Starts calibration for the compass.
|
void |
stopCalibration()
Ends calibration sequence.
|
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 MindsensorsCompass(I2CPort port, int address)
port
- I2C port for the compassaddress
- The I2C address used by the sensorpublic MindsensorsCompass(I2CPort port)
port
- I2C port for the compasspublic MindsensorsCompass(Port port, int address)
port
- Sensor port for the compassaddress
- The I2C address used by the sensorpublic MindsensorsCompass(Port port)
port
- Sensor port for the compassprotected void init()
public SensorMode getCompassMode()
Size and content of the sample
The sample contains one element containing the bearing of the sensor
relative to north expressed in degrees. East being at 90 degrees.
public SensorMode getAngleMode()
Size and content of the sample
The sample contains one element containing the bearing of the sensor
relative to north expressed in degrees using a right hand coordinate system
in the range of (-180 to 180). West being at 90 degrees, east being at -90
degrees.
public void startCalibration()
startCalibration
in interface Calibrate
public void stopCalibration()
stopCalibration
in interface Calibrate