|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IAccelerometer3D
IAccelerometer3D provides methods that should be meaningful for any 3-axis accelerometer. One set of methods return the current acceleration measured along each axis. Another set of methods return the current acceleration relative to a previously measured acceleration. This allows one to zero out the force of gravity on the SPOT and measure the relative acceleration only. A third set of methods use the acceleration along an axis in order to compute the inclination, or tilt, of that axis.
Field Summary | |
---|---|
static boolean |
ABSOLUTE
|
static int |
ALL_AXES
|
static boolean |
RELATIVE
|
static int |
X_AXIS
|
static int |
Y_AXIS
|
static int |
Z_AXIS
|
Method Summary | |
---|---|
void |
addIAccelerometer3DThresholdListener(IAccelerometer3DThresholdListener who)
Adds the specified scalar input threshold listener to receive callbacks from this input device. |
boolean |
areThresholdEventsEnabled(int axis)
Return whether threshold events are enabled or not. |
void |
enableThresholdEvents(int axis,
boolean enable)
Enable or disable threshold events. |
double |
getAccel()
Compute the current total acceleration. |
double |
getAccel(int axis)
Compute the current acceleration for the indicated axis. |
double |
getAccelX()
Read the current acceleration along the X axis. |
double |
getAccelY()
Read the current acceleration along the Y axis. |
double |
getAccelZ()
Read the current acceleration along the Z axis. |
double |
getHighThreshold(int axis,
boolean relative)
Return the current high threshold value. |
IAccelerometer3DThresholdListener[] |
getIAccelerometer3DThresholdListeners()
Returns an array of all the scalar input threshold listeners registered on this input device. |
double |
getLowThreshold(int axis,
boolean relative)
Return the current low threshold value. |
double |
getRelativeAccel()
Compute the current relative total acceleration. |
double |
getRelativeAccel(int axis)
Compute the current relative acceleration for the indicated axis. |
double |
getRelativeAccelX()
Read the current relative acceleration along the X axis. |
double |
getRelativeAccelY()
Read the current relative acceleration along the Y axis. |
double |
getRelativeAccelZ()
Read the current relative acceleration along the Z axis. |
double |
getTilt(int axis)
Compute the inclination of the specified SPOT axis. |
double |
getTiltX()
Compute the inclination of the SPOT's X axis. |
double |
getTiltY()
Compute the inclination of the SPOT's Y axis. |
double |
getTiltZ()
Compute the inclination of the SPOT's Z axis. |
void |
removeIAccelerometer3DThresholdListener(IAccelerometer3DThresholdListener who)
Removes the specified scalar input threshold listener so that it no longer receives callbacks from this input device. |
void |
setRestOffsets()
Compute the current acceleration along each axis and save it. |
void |
setThresholds(int axis,
double low,
double high,
boolean relative)
Set the low and high threshold values for this scalar input. |
boolean |
supportsThresholdEvents()
Returns whether the underlying hardware supports threshold events. |
Field Detail |
---|
static final int X_AXIS
static final int Y_AXIS
static final int Z_AXIS
static final int ALL_AXES
static final boolean RELATIVE
static final boolean ABSOLUTE
Method Detail |
---|
double getAccelX() throws IOException
IOException
double getAccelY() throws IOException
IOException
double getAccelZ() throws IOException
IOException
double getAccel() throws IOException
IOException
double getAccel(int axis) throws IOException
axis
- which axis to return (ALL_AXES = total acceleration)
IOException
void setRestOffsets() throws IOException
IOException
double getRelativeAccelX() throws IOException
IOException
double getRelativeAccelY() throws IOException
IOException
double getRelativeAccelZ() throws IOException
IOException
double getRelativeAccel() throws IOException
IOException
double getRelativeAccel(int axis) throws IOException
axis
- which axis to return (ALL_AXES = total acceleration)
IOException
double getTiltX() throws IOException
IOException
double getTiltY() throws IOException
IOException
double getTiltZ() throws IOException
IOException
double getTilt(int axis) throws IOException
axis
- which axis to return Note: specifying ALL_AXES will throw an IllegalArgumentException.
IOException
boolean supportsThresholdEvents()
void addIAccelerometer3DThresholdListener(IAccelerometer3DThresholdListener who)
who
- the light sensor threshold listener to add.void removeIAccelerometer3DThresholdListener(IAccelerometer3DThresholdListener who)
who
- the scalar input threshold listener to remove.IAccelerometer3DThresholdListener[] getIAccelerometer3DThresholdListeners()
void setThresholds(int axis, double low, double high, boolean relative)
axis
- which axis to set threshold values for.low
- the new low threshold value.high
- the new high threshold value.relative
- compute threshold relative to the current rest offset.double getLowThreshold(int axis, boolean relative)
axis
- which axis to return Note: specifying ALL_AXES will throw an IllegalArgumentException.relative
- if true then threshold is relative to the current rest offset.
double getHighThreshold(int axis, boolean relative)
axis
- which axis to return Note: specifying ALL_AXES will throw an IllegalArgumentException.relative
- if true then threshold is relative to the current rest offset.
void enableThresholdEvents(int axis, boolean enable)
axis
- which axis to enableenable
- if true then listeners will be notified if the scalar input
reading goes above the high threshold or below the low threshold.boolean areThresholdEventsEnabled(int axis)
axis
- which axis to return Note: specifying ALL_AXES will return true
only if all three axes are enabled.
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |