aster94 / sensorfusion Goto Github PK
View Code? Open in Web Editor NEWA simple implementation of some complex Sensor Fusion algorithms
License: GNU General Public License v3.0
A simple implementation of some complex Sensor Fusion algorithms
License: GNU General Public License v3.0
I want to make a port of your code to de-arduinofi it and use it with ESP32 IDF. Unfortunately I am doing this to use it in a commercial project. It is fine for me to fork you code, modify it and make it public but I can not release the rest of the commercial firmware. AFAICT GPL3 will require me to do this. Could you change to LGPL or MIT? That way people can include your code without having to publish their code (they still have to publish mods with LGPL). I notice that https://github.com/PaulStoffregen/MahonyAHRS has no license information at all. The MahonyAHRS.cpp file says 'From the x-io website "Open-source resources available on this website are
// provided under the GNU General Public Licence unless an alternative licence
// is provided in source."'
But the https://github.com/xioTechnologies/Fusion shows the MIT license. It is a bit of a mess. GPL is probably the wrong one to use in any case.
I'm trying to obtain acceleration from my IMU in the world reference frame. The approach I'm trying is to take the quaternion from getQuat(), get its conjugate, then multiply it by the acceleration vector. My code is here: https://pastebin.com/rYEc3R8c
My expectation is that when I rotate my IMU, the rotated acceleration stays constant because it is measuring gravity in the world reference frame. But that is not what happens. Instead, the 'rotated' acceleration changes as the IMU rotates. Logs are here: https://pastebin.com/n6DdXgrj
Why is this happening? Could it be that the rotation quaternion isn't accurate?
Can you mention how to calibrate the IMU please?
Hi, im using this as a part of a rocket datalogger and as such need as few sensors as possible. i have forgone a magnetometer under the understanding that only accelerometers and gryos are needed. Is there a way to use just the accelerometer data to get initial pitch and yaw. I understand that roll cannot be gathered from just accelerometer data and am fine with that. I dont mind how the axis are oriented so long as up is up and i have 2 sideways directions if that makes sense. Thanks
getQuat() maybe. And then a small Quaternion class to handle all four values at once.
For now I'm just going to make q0,q1,q2,q3 public for my personal stuff.
Hi Aster94
I'm using library with an Arduino BLE Sense with embedded Gyroscope and an external micro display. It seems it needs seconds to stabilize values, should I use an external IMU or what I'm doing wrong?
`#include <Arduino.h>
#include <Arduino_LSM9DS1.h> // Sensoristica
#include <U8g2lib.h> // Display
#include <SensorFusion.h> // Calcolo
// Inizializzazione DISPLAY
U8G2_LD7032_60X32_F_4W_SW_SPI u8g2(U8G2_MIRROR, /* clock=/ 9, / data=/ 8, / cs=/ 11, / dc=/ 10, / reset=/ 12); // PROTOTIPO SALDATO SU BASETTA
//U8G2_LD7032_60X32_F_4W_SW_SPI u8g2(U8G2_MIRROR, / clock=/ 11, / data=/ 12, / cs=/ 9, / dc=/ 10, / reset=*/ 8);
const int samplingCicleBeforeRefresh = 30;
SF fusion;
float xAcc, yAcc, zAcc;
float xGyro, yGyro, zGyro;
float xMag, yMag, zMag;
float deltat;
int roll, pitch, yaw;
void setup() {
Serial.begin(115200);
//while (!Serial);
Serial.println("Started");
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
//filter.begin(sensorRate);
u8g2.begin();
deltat=fusion.deltatUpdate();
// Abbasso il PIN per poter attivare il display (aggancio la massa)
pinMode(A0, OUTPUT);
digitalWrite(A0, LOW);
}
void refreshDisplay(int yaw, int pitch, int roll)
{
char buff[16];
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_artosserif8_8u);
snprintf (buff, sizeof(buff), "R%d ", yaw);
u8g2.drawStr(10,10,buff);
Serial.print(buff);
snprintf (buff, sizeof(buff), "F%d ", pitch);
u8g2.drawStr(10,19,buff);
Serial.print(buff);
snprintf (buff, sizeof(buff), "I%d ", roll);
u8g2.drawStr(10,28,buff);
Serial.println(buff);
u8g2.sendBuffer();
}
void loop() {
// read accelerometer & gyrometer:
IMU.readAcceleration(xAcc, yAcc, zAcc);
IMU.readGyroscope(xGyro, yGyro, zGyro);
IMU.readMagneticField(xMag, yMag, zMag);
deltat = fusion.deltatUpdate(); //this have to be done before calling the fusion update
//choose only one of these two:
//fusion.MahonyUpdate(xGyro, yGyro, zGyro, xAcc, yAcc, zAcc, deltat); //mahony is suggested if there isn't the mag and the mcu is slow
fusion.MadgwickUpdate(xGyro * DEG_TO_RAD, yGyro * DEG_TO_RAD, zGyro * DEG_TO_RAD, xAcc, yAcc, zAcc, xMag, yMag, zMag, deltat); //else use the magwick, it is slower but more accurate
// print the heading, pitch and roll
roll = round(fusion.getRoll());//round(fusion.getRoll()-90);
pitch = round(fusion.getPitch());
yaw = round(fusion.getYaw());//round(180-fusion.getYaw());
//Serial.print("Y ");
//Serial.print(yaw);
//Serial.print(" P ");
//Serial.print(pitch);
//Serial.print(" R ");
//Serial.println(roll);
refreshDisplay (yaw, pitch, roll);
}`
Thank you
Regards
c:\Users\black\Documents\Arduino\libraries\SensorFusion-1.0.5\src\SensorFusion.cpp: In static member function 'static float SF::invSqrt(float)':
c:\Users\black\Documents\Arduino\libraries\SensorFusion-1.0.5\src\SensorFusion.cpp:67:9: error: 'y' was not declared in this scope
return y;
^
exit status 1
Compilation error: exit status 1
I am wondering how to wire the MPU9250 (GY-91) breakout board to blue pill? I am interested specifically in the pin numbers. As there are more than one SPI ports in blue pill so I can't understand the guidelines mentioned here: https://github.com/bolderflight/MPU9250#spi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.