Comments (23)
Oke nvm i made a mistake, i added accel before i shouldve added gyro.
But it still does not work entirely.
const madgwick = new AHRS({
/*
* The sample interval, in Hz.
*
* Default: 20
*/
sampleInterval: 10,
/*
* Choose from the `Madgwick` or `Mahony` filter.
*
* Default: 'Madgwick'
*/
algorithm: 'Mahony',
/*
* The filter noise value, smaller values have
* smoother estimates, but have higher latency.
* This only works for the `Madgwick` filter.
*
* Default: 0.4
*/
beta: 0.4,
/*
* The filter noise values for the `Mahony` filter.
*/
kp: 0.5, // Default: 0.5
ki: 0, // Default: 0.0
/*
* When the AHRS algorithm runs for the first time and this value is
* set to true, then initialisation is done.
*
* Default: false
*/
doInitialisation: false,
});
madgwick.update(gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z, magn_x, magn_y, magn_z);
let quat= madgwick.getQuaternion();
// console.log(axes.pitch*57.295779513, axes.roll*57.295779513, axes.heading*57.295779513);
console.log(quat)
When i do this, it goes back to its first value, and that should not be the case.
from ahrs.
I don't know what you mean "it goes back to its first value". You have turned of doInitialisation
, this means you will need run to the uptate()
function many times (around 100) until you get sensible values.
Unless you understand quarternions, I don't think you would want the print out the quaternion. The Euler angles make more sense.
from ahrs.
So if i turn my object the euler angles goes to like 1.2 or something and if i hold it still it goes back to 0.1 or something. It doesnt stay at the angle. I get data every 10 Hz because i use Serialport and i get there data every 10 Hz from
from ahrs.
What do your raw input and output values look like? I'd also suggest using the Madgwick filter.
from ahrs.
My raw input is from 1350 to -1350 or something
from ahrs.
I need more detail. 1350 is what? What are your raw x,y,z values for the accelerometer, gyroscope and magnetometer input? The values that you put into update()
.
from ahrs.
madgwick.update(gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z, magn_x, magn_y, magn_z);
This is what i put in, i have the chip LSM9DS1TR (simular to LSM9DS1)
from ahrs.
This is what i found
The LSM9DS1 is a high-resolution (16-bit) 9-axis motion sensor (accelerometer, gyroscope, and magnetometer) in a 3 mm x 3.5 mm LGA 28 pin package. Coupled with the fine 24-bit Measurement Specialties MS5611 altimeter, the Teensy 3.1 add-on/breakout board offers 10 degrees of freedom in a compact size for many motion control applications.
from ahrs.
Thank you, but what the actual values of gyro_x
, gyro_y
, gyro_z
, accel_x
, accel_y
, accel_z
, magn_x
, magn_y
, and magn_z
?
For example accel_z
might be something like 1.0
.
from ahrs.
Its an integer, its never a float (by default values)
from ahrs.
from ahrs.
from ahrs.
Finally. Those values are not going to work. You need to convert them to the correct units. Your LSM9DS1 spec documentation will detail what units it outputs. See the Units section in the Readme.
from ahrs.
So i should devide the accelerometer by 9.81 and gyroscope by 0.07 (dps)
from ahrs.
let accel_x = data.accel_x_mg/9.81, //velocity
accel_y = data.accel_z_mg/9.81, //velocity
accel_z = data.accel_y_mg/9.81, //velocity
gyro_x = data.gyro_x_dps*0.07/57.295779513, //degrees per radians.
gyro_y = data.gyro_z_dps*0.07/57.295779513, //degrees per radians.
gyro_z = data.gyro_y_dps*0.07/57.295779513, //degrees per radians.
So i should do this?
from ahrs.
Your LSM9DS1 spec documentation will detail what "units" it outputs and you need to convert that to units suitable for this AHRS implementation.
Just multiplying the numbers "randomly" will not fix the issue.
from ahrs.
This is not the place to ask about the LSM9DS1 output. I'm closing this issue, since this is not a bug in AHRS.
from ahrs.
But im not understanding what i should change it to
from ahrs.
Also if i do this
let thetaM = Math.atan2(accel_x, Math.sqrt(accel_y*accel_y+accel_z*accel_z));
let phiM = Math.atan2(accel_y, Math.sqrt(accel_x*accel_x+accel_z*accel_z))
console.log(thetaM*57.295779513, phiM*57.295779513)
I get correct angles
from ahrs.
Please understand, I'm not here to support you for unrelated issues. This forum is for logging bugs against AHRS. If you have questions like this you can go to stackoverflow.com, or similar.
from ahrs.
its kinda a bug tho, because it works with that formula and not with your thing
from ahrs.
This are my units, so i divide them correctly
from ahrs.
This is my last comment on this thread. The units you have shown me are wrong. The page you show me tells me you don't understand the problem. Your problem is with the output of the LSM9SD1, not this library. You should use "duckduckgo" and search for "LSM9DS1 tutorial".
The units of required by AHRS is are as follows:
- gyroscope: in radians per second, so when stationary these average around zero, typically around +/-0.001 just due to noise. When you constantly rotate it 180 degrees in 1 second one axis will go up to
PI/2.0
. - accelerometer - in g, so the values when stationary will range from -1.0 to 1.0. Such that
sqrt(a_x*a_x + a_y*a_y + a_z*a_z)
is around1.0
. - Magnetometer - values are proportional to the Earth's magnetic field. These units you have look reasonable.
from ahrs.
Related Issues (20)
- Kp and Ki different? HOT 4
- Axis rotation HOT 2
- a question about the package HOT 3
- Using an offset to overcome hinder with pitch in Euler angles? HOT 2
- Gyro & Acc HOT 1
- Calculate sample interval HOT 9
- GetEuler angle always gives values in range of -3 to 3. Am i missing something? HOT 9
- Is this possible to get the position difference or the distance the device was moved from the initial point? HOT 3
- Make require algorithm names static
- Get user heading HOT 4
- Tilt Correction when it comes to heading? HOT 4
- Sorry, I have a low-level problem. I don't understand how to use it in a browser. I tried to use it this way, but the result was incorrect HOT 4
- Possible variable wrong? HOT 3
- Update Issues HOT 3
- Unexplainable drifting in output HOT 11
- Fast initialization HOT 7
- Combining AHRS with gyronorm.js HOT 12
- test data HOT 1
- Inaccurate heading when using iOS sensors and Madgwick HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ahrs.