diff options
author | Keith Packard <keithp@keithp.com> | 2017-06-08 20:37:58 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-06-08 20:37:58 -0700 |
commit | 32de85691f2e4ed1430a259e05a514ad820b32d9 (patch) | |
tree | 25ba96ae1bf03732c4cb6ef419bdc9286be1f091 /altoslib/AltosIMU.java | |
parent | 4c5acb57d7ac1abec7bb4cda9dc88c2a19767a2d (diff) |
altoslib: Compute orientation from eeprom data files
This was lost in the AltosFlightSeries transformation.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosIMU.java')
-rw-r--r-- | altoslib/AltosIMU.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/altoslib/AltosIMU.java b/altoslib/AltosIMU.java index 20a2a413..b434e02e 100644 --- a/altoslib/AltosIMU.java +++ b/altoslib/AltosIMU.java @@ -36,10 +36,12 @@ public class AltosIMU implements Cloneable { return counts / counts_per_g * AltosConvert.gravity; } - public static final double counts_per_degsec = 16.4; + /* In radians */ + public static final double GYRO_FULLSCALE_DEGREES = 2000.0; + public static final double GYRO_COUNTS = 32767.0; - public static double convert_gyro(double counts) { - return counts / counts_per_degsec; + public static double gyro_degrees_per_second(double counts, double cal) { + return (counts - cal) * GYRO_FULLSCALE_DEGREES / GYRO_COUNTS; } public boolean parse_string(String line) { |