SunSPOT API V6.0


com.sun.spot.resources.transducers
Interface IAccelerometer3D

All Superinterfaces:
IResource, ITransducer
All Known Implementing Classes:
Accelerometer3D, LIS3L02AQAccelerometer, MMA7455LAccelerometer

public interface IAccelerometer3D
extends ITransducer

IAccelerometer3D provides methods that should be meaningful for any 3-axis accelerometer. One set of methods return the current acceleration measured along each axis. A second set of methods use the acceleration along an axis in order to compute the inclination, or tilt, of that axis.

Author:
Ron Goldman

Field Summary
static int ALL_AXES
           
static int X_AXIS
           
static int Y_AXIS
           
static int Z_AXIS
           
 
Method Summary
 double getAccel()
          Compute the current total acceleration.
 double getAccel(int axis)
          Read the current acceleration for the indicated axis.
 double[] getAccelValues()
          Return all the current values.
 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 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.
 
Methods inherited from interface com.sun.spot.resources.transducers.ITransducer
createSensorEvent, getDescription, getMaxSamplingRate, saveEventState
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

Field Detail

X_AXIS

static final int X_AXIS
See Also:
Constant Field Values

Y_AXIS

static final int Y_AXIS
See Also:
Constant Field Values

Z_AXIS

static final int Z_AXIS
See Also:
Constant Field Values

ALL_AXES

static final int ALL_AXES
See Also:
Constant Field Values
Method Detail

getAccelX

double getAccelX()
                 throws IOException
Read the current acceleration along the X axis.

Returns:
the current acceleration in G's along the X axis
Throws:
IOException

getAccelY

double getAccelY()
                 throws IOException
Read the current acceleration along the Y axis.

Returns:
the current acceleration in G's along the Y axis
Throws:
IOException

getAccelZ

double getAccelZ()
                 throws IOException
Read the current acceleration along the Z axis.

Returns:
the current acceleration in G's along the Z axis
Throws:
IOException

getAccel

double getAccel(int axis)
                throws IOException
Read the current acceleration for the indicated axis.

Parameters:
axis - which axis to return (ALL_AXES = total acceleration)
Returns:
the current acceleration in G's
Throws:
IOException

getAccel

double getAccel()
                throws IOException
Compute the current total acceleration. This is the vector sum of the acceleration along the X, Y & Z axes.

Returns:
the current total acceleration in G's
Throws:
IOException

getAccelValues

double[] getAccelValues()
                        throws IOException
Return all the current values.

Returns:
all current values as array [ Ax, Ay, Az ]
Throws:
IOException

getTiltX

double getTiltX()
                throws IOException
Compute the inclination of the SPOT's X axis. This angle is with respect to any acceleration if the SPOT is moving.

Returns:
the current angle of the X axis in radians, in the range of -pi/2 through pi/2.
Throws:
IOException

getTiltY

double getTiltY()
                throws IOException
Compute the inclination of the SPOT's Y axis. This angle is with respect to any acceleration if the SPOT is moving.

Returns:
the current angle of the Y axis in radians, in the range of -pi/2 through pi/2.
Throws:
IOException

getTiltZ

double getTiltZ()
                throws IOException
Compute the inclination of the SPOT's Z axis. This angle is with respect to any acceleration if the SPOT is moving.

Returns:
the current angle of the Z axis in radians, in the range of -pi/2 through pi/2.
Throws:
IOException

getTilt

double getTilt(int axis)
               throws IOException
Compute the inclination of the specified SPOT axis. This angle is with respect to any acceleration if the SPOT is moving.

Parameters:
axis - which axis to return Note: specifying ALL_AXES will throw an IllegalArgumentException.
Returns:
the current angle of the indicated axis in radians, in the range of -pi/2 through pi/2.
Throws:
IOException

SunSPOT API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.