From bd2b303b596a61d314c055f35c19f9039b8823d7 Mon Sep 17 00:00:00 2001 From: Eric Westphal Date: Fri, 15 Jul 2016 01:31:03 -0400 Subject: [PATCH] Prepare for proper AHRS calculation --- mpu/mpu6050.go | 9 +++++++++ mpu/mpu9250.go | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/mpu/mpu6050.go b/mpu/mpu6050.go index 660608a4..6defdbeb 100644 --- a/mpu/mpu6050.go +++ b/mpu/mpu6050.go @@ -196,3 +196,12 @@ func (d *MPU6050) MagHeading() (float64, error) {return 0, nil} func (d *MPU6050) SlipSkid() (float64, error) {return 0, nil} func (d *MPU6050) RateOfTurn() (float64, error) {return 0, nil} func (d *MPU6050) GLoad() (float64, error) {return 0, nil} + +func (d *MPU6050) ReadRaw() (int64, float64, float64, float64, float64, float64, float64, float64, float64, float64, error, error) { + return 0, // Ts, time of last sensor reading + 0.0, 0.0, 0.0, // Gyro x, y, z + 0.0, 0.0, 0.0, // Accel x, y, z + 0.0, 0.0, 0.0, // Mag x, y, z + errors.New("Error: ReadRaw() not implemented yet for MPU6050"), + errors.New("Error: MPU6050 magnetometer isn't working on RY835AI chip") +} diff --git a/mpu/mpu9250.go b/mpu/mpu9250.go index f981a070..7dfd5acb 100644 --- a/mpu/mpu9250.go +++ b/mpu/mpu9250.go @@ -185,6 +185,10 @@ func (m *MPU9250) GLoad() (float64, error) { } } +func (m *MPU9250) ReadRaw() (int64, float64, float64, float64, float64, float64, float64, float64, float64, float64, error, error) { + return m.mpu.Read() +} + func (m *MPU9250) Close() { if m.quit != nil { m.quit <- struct{}{}