-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working #19
Comments
Oke nvm i made a mistake, i added accel before i shouldve added gyro. 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. |
I don't know what you mean "it goes back to its first value". You have turned of Unless you understand quarternions, I don't think you would want the print out the quaternion. The Euler angles make more sense. |
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 |
What do your raw input and output values look like? I'd also suggest using the Madgwick filter. |
My raw input is from 1350 to -1350 or something |
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 |
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) |
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. |
Thank you, but what the actual values of |
Its an integer, its never a float (by default values) |
To be able to diagnose the problem, I need the actual values. Can you run
the following and send the output.
console.log(gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z, magn_x,
magn_y, magn_z);
…On Mon, 18 Oct 2021 at 20:23, Arthur ***@***.***> wrote:
Its an integer, its never a float
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQG7ZG2DBDJDUVKRRO3BSLUHPDQRANCNFSM5F7FSHNQ>
.
|
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. |
So i should devide the accelerometer by 9.81 and gyroscope by 0.07 (dps) |
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? |
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. |
This is not the place to ask about the LSM9DS1 output. I'm closing this issue, since this is not a bug in AHRS. |
But im not understanding what i should change it to |
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 |
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. |
its kinda a bug tho, because it works with that formula and not with your thing |
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:
|
I tried to use AHRS but the data what i got in return is not right.
I have an LSM9DS1 chip and i get data every 10Hz. But if i try to use getEulerAngles or getQuaternion() it returns not any correct data.
with the quaternion its from 2 to -2 to 0 and that goes on forever.
This is the data (also raw magnetometer)
The text was updated successfully, but these errors were encountered: