|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecticommand.nxt.I2CSensor
icommand.nxt.CompassSensor
public class CompassSensor
Currently supports Mindsensors.com Compass V1.1 and 2.0 (CMPS-Nx) and HiTechnic compass sensors. Auto-detects appropriate model.
Field Summary | |
---|---|
static byte |
EU_MODE
|
static byte |
USA_MODE
|
Fields inherited from class icommand.nxt.I2CSensor |
---|
DEFAULT_ADDRESS, PRODUCT_ID, SENSOR_TYPE, STOP, VERSION |
Constructor Summary | |
---|---|
CompassSensor(SensorPort s)
Initializes a Compass using USA mode by default. |
Method Summary | |
---|---|
protected byte[] |
getData(byte register,
int length)
Override method because of unreliability retrieving more than a single byte at a time with some I2C Sensors (bug in Lego firmware). |
double |
getDegrees()
Returns the directional heading in degrees. |
double |
getDegreesCartesian()
Compass readings increase clockwise from 0 to 360, but Cartesian coordinate systems increase counter-clockwise. |
double |
getRadians()
Returns the directional heading in degrees. |
void |
resetCartesianZero()
Changes the current direction the compass is facing into the zero angle. |
void |
setRegion(byte region)
Mindsensors only. |
void |
startCalibration()
Begins calibrating the compass sensor resulting in more accurate measurements. |
void |
stopCalibration()
|
Methods inherited from class icommand.nxt.I2CSensor |
---|
fetchString, getData, getId, getProductID, getSensorType, getVersion, sendData, sendData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte USA_MODE
public static final byte EU_MODE
Constructor Detail |
---|
public CompassSensor(SensorPort s)
Method Detail |
---|
public void setRegion(byte region)
region
- Use Compass.USA_MODE or Compass.EU_MODEpublic void startCalibration()
public void stopCalibration()
startCalibration()
public double getRadians()
public double getDegrees()
public double getDegreesCartesian()
public void resetCartesianZero()
protected byte[] getData(byte register, int length)
getData
in class I2CSensor
register
- e.g. FACTORY_SCALE_DIVISOR, BYTE0, etc....length
- Length of data to read (minimum 1, maximum 16)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |