|
|||||||||
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.DIMUAccel
public class DIMUAccel
This class provides access to the accelerometer of Dexter Industries IMU sensor
Nested Class Summary | |
---|---|
static class |
DIMUAccel.AccelUnits
List of possible units for acceleration |
static class |
DIMUAccel.TiltUnits
List of possible units for Tilt |
Field Summary | |
---|---|
protected static int |
ACCEL
|
protected DIMUAccel.AccelUnits |
accelUnit
The default unit to use when retuning acceleration data from the accelerometer |
protected static int |
DEFAULT_I2C_ADDRESS
|
protected static int |
MODE_REG
|
protected float |
multiplier
A factor to use when converting raw data from the accelerometer. |
protected float[] |
offset
|
protected static int |
samples
|
protected float[] |
scale
|
protected DIMUAccel.TiltUnits |
tiltUnit
The default unit to use when retuning tilt data from the accelerometer |
Fields inherited from class lejos.nxt.I2CSensor |
---|
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 | |
---|---|
DIMUAccel(I2CPort port)
|
Method Summary | |
---|---|
void |
calibrateAxis(char axis)
Calibrates a single axis. |
void |
fetchAllAccel(float[] ret)
Acceleration along 3 axis. |
void |
fetchAllAccel(float[] ret,
DIMUAccel.AccelUnits unit)
Acceleration along 3 axis. |
void |
fetchAllTilt(float[] ret)
Tilt along 3 axis |
void |
fetchAllTilt(float[] ret,
DIMUAccel.TiltUnits unit)
Tilt along 3 axis. |
void |
fetchRawAccel(int[] ret)
|
DIMUAccel.AccelUnits |
getAccelUnit()
Returns the current acceleration unit |
protected float |
getMultiplier()
|
String |
getProductID()
Read the sensor's product identifier. |
DIMUAccel.TiltUnits |
getTiltUnit()
Returns the current unit for tilt |
String |
getVendorID()
Read the sensor's vendor identifier. |
String |
getVersion()
Read the sensor's version string. |
int |
getXAccel()
Measures the x-axis of the accelerometer, in meters/second^2. |
int |
getYAccel()
Measures the y-axis of the accelerometer, in meters/second^2. |
int |
getZAccel()
Measures the z-axis of the accelerometer, in meters/second^2. |
void |
load()
Loads saved offset and scale values from memory. |
void |
save()
Saves the offset and scale factors in Flash memory. |
void |
setAccelUnit(DIMUAccel.AccelUnits accelUnit)
Sets the unit for acceleration |
void |
setTiltUnit(DIMUAccel.TiltUnits tiltUnit)
Sets the unit for tilt |
Methods inherited from class lejos.nxt.I2CSensor |
---|
fetchString, getAddress, getData, getData, getPort, sendData, sendData, sendData, setAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int ACCEL
protected static final int MODE_REG
protected static final int DEFAULT_I2C_ADDRESS
protected float[] offset
protected float[] scale
protected static int samples
protected DIMUAccel.AccelUnits accelUnit
protected DIMUAccel.TiltUnits tiltUnit
protected float multiplier
Constructor Detail |
---|
public DIMUAccel(I2CPort port)
port
- Method Detail |
---|
public void calibrateAxis(char axis)
Calibration settings are held in memory. To store these values one should
use the
method.
save()
axis
- Axis should have the value X,Y or Zpublic void fetchAllAccel(float[] ret)
public void fetchAllAccel(float[] ret, DIMUAccel.AccelUnits unit)
unit
- of accelerationpublic void fetchAllTilt(float[] ret)
public void fetchAllTilt(float[] ret, DIMUAccel.TiltUnits unit)
unit
- of tiltpublic void fetchRawAccel(int[] ret)
public DIMUAccel.AccelUnits getAccelUnit()
protected float getMultiplier()
public String getProductID()
I2CSensor
getProductID
in class I2CSensor
public String getVendorID()
I2CSensor
getVendorID
in class I2CSensor
public DIMUAccel.TiltUnits getTiltUnit()
public String getVersion()
I2CSensor
getVersion
in class I2CSensor
public void load()
public void save()
public void setAccelUnit(DIMUAccel.AccelUnits accelUnit)
accelUnit
- public void setTiltUnit(DIMUAccel.TiltUnits tiltUnit)
tiltUnit
- public int getXAccel()
Accelerometer
getXAccel
in interface Accelerometer
public int getYAccel()
Accelerometer
getYAccel
in interface Accelerometer
public int getZAccel()
Accelerometer
getZAccel
in interface Accelerometer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |