Compare commits
19 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69fbb4021a | ||
|
|
7d37a88d79 | ||
|
|
6d80c3abc3 | ||
|
|
b14657f111 | ||
|
|
1f304b21f1 | ||
|
|
b7e1039f9c | ||
|
|
8cd362a6ae | ||
|
|
871109abcd | ||
|
|
bfe18e94d9 | ||
|
|
bf743c13b1 | ||
|
|
3e8f6ca264 | ||
|
|
3b5285f636 | ||
|
|
8d4ebb8526 | ||
|
|
09ff9f7b07 | ||
|
|
55a9541375 | ||
|
|
69b3a854be | ||
|
|
007b8b2678 | ||
|
|
278089246a | ||
|
|
971568365d |
13 changed files with 48 additions and 36 deletions
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
|
|
@ -7,11 +7,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: adafruit/ci-arduino
|
repository: adafruit/ci-arduino
|
||||||
path: ci
|
path: ci
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@
|
||||||
Adafruit_LIS3MDL lis3mdl;
|
Adafruit_LIS3MDL lis3mdl;
|
||||||
|
|
||||||
// Can change this to be LSM6DSOX or whatever ya like
|
// Can change this to be LSM6DSOX or whatever ya like
|
||||||
|
// For (older) Feather Sense with LSM6DS33, use this:
|
||||||
#include <Adafruit_LSM6DS33.h>
|
#include <Adafruit_LSM6DS33.h>
|
||||||
Adafruit_LSM6DS33 lsm6ds;
|
Adafruit_LSM6DS33 lsm6ds;
|
||||||
|
// For (newer) Feather Sense with LSM6DS3TR-C, use this:
|
||||||
|
// #include <Adafruit_LSM6DS3TRC.h>
|
||||||
|
// Adafruit_LSM6DS3TRC lsm6ds;
|
||||||
|
|
||||||
bool init_sensors(void) {
|
bool init_sensors(void) {
|
||||||
if (!lsm6ds.begin_I2C() || !lis3mdl.begin_I2C()) {
|
if (!lsm6ds.begin_I2C() || !lis3mdl.begin_I2C()) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
Adafruit_Sensor *accelerometer, *gyroscope, *magnetometer;
|
Adafruit_Sensor *accelerometer, *gyroscope, *magnetometer;
|
||||||
|
|
||||||
// uncomment one combo 9-DoF!
|
// uncomment one combo 9-DoF!
|
||||||
#include "LSM6DS_LIS3MDL.h" // can adjust to LSM6DS33, LSM6DS3U, LSM6DSOX...
|
#include "LSM6DS_LIS3MDL.h" // see the the LSM6DS_LIS3MDL file in this project to change board to LSM6DS33, LSM6DS3U, LSM6DSOX, etc
|
||||||
//#include "LSM9DS.h" // LSM9DS1 or LSM9DS0
|
//#include "LSM9DS.h" // LSM9DS1 or LSM9DS0
|
||||||
//#include "NXP_FXOS_FXAS.h" // NXP 9-DoF breakout
|
//#include "NXP_FXOS_FXAS.h" // NXP 9-DoF breakout
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@
|
||||||
Adafruit_LIS3MDL lis3mdl;
|
Adafruit_LIS3MDL lis3mdl;
|
||||||
|
|
||||||
// Can change this to be LSM6DS33 or whatever ya like
|
// Can change this to be LSM6DS33 or whatever ya like
|
||||||
|
// For (older) Feather Sense with LSM6DS33, use this:
|
||||||
#include <Adafruit_LSM6DS33.h>
|
#include <Adafruit_LSM6DS33.h>
|
||||||
Adafruit_LSM6DS33 lsm6ds;
|
Adafruit_LSM6DS33 lsm6ds;
|
||||||
|
// For (newer) Feather Sense with LSM6DS3TR-C, use this:
|
||||||
|
// #include <Adafruit_LSM6DS3TRC.h>
|
||||||
|
// Adafruit_LSM6DS3TRC lsm6ds;
|
||||||
|
|
||||||
bool init_sensors(void) {
|
bool init_sensors(void) {
|
||||||
if (!lsm6ds.begin_I2C() || !lis3mdl.begin_I2C()) {
|
if (!lsm6ds.begin_I2C() || !lis3mdl.begin_I2C()) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
#include <Adafruit_LSM303_U.h>
|
#include <Adafruit_LSM303_Accel.h>
|
||||||
|
#include <Adafruit_LSM303DLH_Mag.h>
|
||||||
#include <Adafruit_BMP085_U.h>
|
#include <Adafruit_BMP085_U.h>
|
||||||
#include <Adafruit_Simple_AHRS.h>
|
#include <Adafruit_Simple_AHRS.h>
|
||||||
|
|
||||||
// Create sensor instances.
|
// Create sensor instances.
|
||||||
Adafruit_LSM303_Accel_Unified accel(30301);
|
Adafruit_LSM303_Accel_Unified accel(30301);
|
||||||
Adafruit_LSM303_Mag_Unified mag(30302);
|
Adafruit_LSM303DLH_Mag_Unified mag(30302);
|
||||||
Adafruit_BMP085_Unified bmp(18001);
|
Adafruit_BMP085_Unified bmp(18001);
|
||||||
|
|
||||||
// Create simple AHRS algorithm using the above sensors.
|
// Create simple AHRS algorithm using the above sensors.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
#include <Adafruit_LSM303_U.h>
|
#include <Adafruit_LSM303_Accel.h>
|
||||||
|
#include <Adafruit_LSM303DLH_Mag.h>
|
||||||
#include <Adafruit_Simple_AHRS.h>
|
#include <Adafruit_Simple_AHRS.h>
|
||||||
|
|
||||||
// Create sensor instances.
|
// Create sensor instances.
|
||||||
Adafruit_LSM303_Accel_Unified accel(30301);
|
Adafruit_LSM303_Accel_Unified accel(30301);
|
||||||
Adafruit_LSM303_Mag_Unified mag(30302);
|
Adafruit_LSM303DLH_Mag_Unified mag(30302);
|
||||||
|
|
||||||
// Create simple AHRS algorithm using the above sensors.
|
// Create simple AHRS algorithm using the above sensors.
|
||||||
Adafruit_Simple_AHRS ahrs(&accel, &mag);
|
Adafruit_Simple_AHRS ahrs(&accel, &mag);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name=Adafruit AHRS
|
name=Adafruit AHRS
|
||||||
version=2.3.2
|
version=2.4.0
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=AHRS (Altitude and Heading Reference System) for various Adafruit motion sensors
|
sentence=AHRS (Altitude and Heading Reference System) for various Adafruit motion sensors
|
||||||
|
|
@ -7,4 +7,4 @@ paragraph=Includes motion calibration example sketches, as well as calibration o
|
||||||
category=Sensors
|
category=Sensors
|
||||||
url=https://github.com/adafruit/Adafruit_AHRS
|
url=https://github.com/adafruit/Adafruit_AHRS
|
||||||
architectures=*
|
architectures=*
|
||||||
depends=Adafruit Unified Sensor, Adafruit LSM6DS, Adafruit LIS3MDL, Adafruit FXOS8700, Adafruit FXAS21002C, Adafruit LSM9DS1 Library, Adafruit LSM9DS0 Library, Adafruit LSM303DLHC, Adafruit BMP085 Unified, Adafruit BluefruitLE nRF51, SdFat - Adafruit Fork, ArduinoJson, Adafruit SPIFlash, Adafruit Sensor Calibration
|
depends=Adafruit Unified Sensor, Adafruit LSM6DS, Adafruit LIS3MDL, Adafruit FXOS8700, Adafruit FXAS21002C, Adafruit LSM9DS1 Library, Adafruit LSM9DS0 Library, Adafruit BMP085 Unified, Adafruit BluefruitLE nRF51, SdFat - Adafruit Fork, ArduinoJson, Adafruit SPIFlash, Adafruit Sensor Calibration, Adafruit LSM303 Accel, Adafruit LSM303DLH Mag
|
||||||
|
|
|
||||||
|
|
@ -282,13 +282,14 @@ void Adafruit_Madgwick::updateIMU(float gx, float gy, float gz, float ax,
|
||||||
|
|
||||||
float Adafruit_Madgwick::invSqrt(float x) {
|
float Adafruit_Madgwick::invSqrt(float x) {
|
||||||
float halfx = 0.5f * x;
|
float halfx = 0.5f * x;
|
||||||
float y = x;
|
union {
|
||||||
long i = *(long *)&y;
|
float f;
|
||||||
i = 0x5f3759df - (i >> 1);
|
long i;
|
||||||
y = *(float *)&i;
|
} conv = {x};
|
||||||
y = y * (1.5f - (halfx * y * y));
|
conv.i = 0x5f3759df - (conv.i >> 1);
|
||||||
y = y * (1.5f - (halfx * y * y));
|
conv.f *= 1.5f - (halfx * conv.f * conv.f);
|
||||||
return y;
|
conv.f *= 1.5f - (halfx * conv.f * conv.f);
|
||||||
|
return conv.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------
|
||||||
|
|
@ -299,6 +300,6 @@ void Adafruit_Madgwick::computeAngles() {
|
||||||
yaw = atan2f(q1 * q2 + q0 * q3, 0.5f - q2 * q2 - q3 * q3);
|
yaw = atan2f(q1 * q2 + q0 * q3, 0.5f - q2 * q2 - q3 * q3);
|
||||||
grav[0] = 2.0f * (q1 * q3 - q0 * q2);
|
grav[0] = 2.0f * (q1 * q3 - q0 * q2);
|
||||||
grav[1] = 2.0f * (q0 * q1 + q2 * q3);
|
grav[1] = 2.0f * (q0 * q1 + q2 * q3);
|
||||||
grav[2] = 2.0f * (q1 * q0 - 0.5f + q3 * q3);
|
grav[2] = 2.0f * (q0 * q0 - 0.5f + q3 * q3);
|
||||||
anglesComputed = 1;
|
anglesComputed = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,13 +261,14 @@ void Adafruit_Mahony::updateIMU(float gx, float gy, float gz, float ax,
|
||||||
|
|
||||||
float Adafruit_Mahony::invSqrt(float x) {
|
float Adafruit_Mahony::invSqrt(float x) {
|
||||||
float halfx = 0.5f * x;
|
float halfx = 0.5f * x;
|
||||||
float y = x;
|
union {
|
||||||
long i = *(long *)&y;
|
float f;
|
||||||
i = 0x5f3759df - (i >> 1);
|
long i;
|
||||||
y = *(float *)&i;
|
} conv = {x};
|
||||||
y = y * (1.5f - (halfx * y * y));
|
conv.i = 0x5f3759df - (conv.i >> 1);
|
||||||
y = y * (1.5f - (halfx * y * y));
|
conv.f *= 1.5f - (halfx * conv.f * conv.f);
|
||||||
return y;
|
conv.f *= 1.5f - (halfx * conv.f * conv.f);
|
||||||
|
return conv.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------
|
||||||
|
|
@ -278,7 +279,7 @@ void Adafruit_Mahony::computeAngles() {
|
||||||
yaw = atan2f(q1 * q2 + q0 * q3, 0.5f - q2 * q2 - q3 * q3);
|
yaw = atan2f(q1 * q2 + q0 * q3, 0.5f - q2 * q2 - q3 * q3);
|
||||||
grav[0] = 2.0f * (q1 * q3 - q0 * q2);
|
grav[0] = 2.0f * (q1 * q3 - q0 * q2);
|
||||||
grav[1] = 2.0f * (q0 * q1 + q2 * q3);
|
grav[1] = 2.0f * (q0 * q1 + q2 * q3);
|
||||||
grav[2] = 2.0f * (q1 * q0 - 0.5f + q3 * q3);
|
grav[2] = 2.0f * (q0 * q0 - 0.5f + q3 * q3);
|
||||||
anglesComputed = 1;
|
anglesComputed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue