public abstract class GyroscopeListener
extends java.lang.Object
Constructor and Description |
---|
GyroscopeListener(HB hb) |
Modifier and Type | Method and Description |
---|---|
float |
scaleValue(double sensor_value,
double scaled_min,
double scaled_max)
Scale the values based on a maximum and minimum sensor value of 1 / -1
The value can be greater than scaled_min and scaled_max if sensor_value is greater than abs(1)
((scaled_max - scaled_min) * (sensor_value - sensor_min)) / (sensor_max - sensor_min) + scaled_min;
|
abstract void |
sensorUpdated(float pitch,
float roll,
float yaw)
Sensor has been updated with these values
|
void |
setRounding(int resolution)
Set the resolution for all three axis to the number of decimal places
set by resolution.
|
public GyroscopeListener(HB hb)
public void setRounding(int resolution)
resolution
- the number of decimal places to round to. -1 will be no roundingpublic float scaleValue(double sensor_value, double scaled_min, double scaled_max)
sensor_value
- The actual value of our sensorscaled_min
- The value we want our standard minimum sensor value to becomescaled_max
- The value we want our standard maximum sensor value to becomepublic abstract void sensorUpdated(float pitch, float roll, float yaw)
pitch
- pitch of gyroscoperoll
- roll of gyroscopeyaw
- yaw of gyroscope