|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.drismo.logic.Calibration
public class Calibration
Calibrates the (roll, pitch and yaw) angles of the device RELATIVE to the cars position and driving direction. By calibrating we can rotate the acceleration vectors relative to the car, which means we can use these vectors to analyze and rate the quality of driving.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private AccelerationHandler |
accHandler
|
private double |
averageBuffer
|
private int |
averageCounter
|
private CalibrationListener |
calibrationListener
|
private static double |
DRIVING_THRESHOLD
|
private boolean |
levelCalibrated
|
private static int |
N
|
private boolean |
offsetFound
|
private double |
xyMagnitudeOffset
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Calibration(AccelerationHandler ah,
CalibrationListener cl)
Stores the acceleration handler and the calibration listener. |
Method Summary | |
---|---|
void |
cancel()
Cancels the calibration. |
void |
onFilteredAccelerationChange(float[] filteredVectors,
float[] rotatedVectors)
Computes the roll, pitch and yaw angles relative to the car. |
void |
run()
Waits 1 second to reduce touch vibration/noise, then initiates the calibration. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private AccelerationHandler accHandler
private CalibrationListener calibrationListener
private double xyMagnitudeOffset
private static final int N
private static final double DRIVING_THRESHOLD
private boolean levelCalibrated
private boolean offsetFound
private double averageBuffer
private int averageCounter
Constructor Detail |
---|
public Calibration(AccelerationHandler ah, CalibrationListener cl)
ah
- The acceleration handler.cl
- The object that listens for changes in calibration.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void cancel()
public void onFilteredAccelerationChange(float[] filteredVectors, float[] rotatedVectors)
onFilteredAccelerationChange
in interface FilteredAccelerationListener
filteredVectors
- The original weighted moving average acceleration vectors (X,Y,Z).rotatedVectors
- The rotated weighted moving average acceleration vectors (X,Y,Z).AccelerationHandler.onSensorChanged(android.hardware.SensorEvent)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |