Skip to content
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

raw and pitch change simultaneously #11

Closed
aa18514 opened this issue Apr 27, 2018 · 18 comments
Closed

raw and pitch change simultaneously #11

aa18514 opened this issue Apr 27, 2018 · 18 comments

Comments

@aa18514
Copy link

aa18514 commented Apr 27, 2018

Hi,

I can confirm the following:

a) I have calibrated my magnetometer, accelerometer and gyroscope correctly.

b) The data being passed in the Mahony and the Madgewick filter is in the correct order.
(ax, ay, az, gx, gy, gz, -1 * mx, my, mz)

I seem to be getting correct orientation for raw, but as pitch changes from +PI/2 to -PI/2, I also observe a change in yaw by PI radians, as pitch starts approach PI/2 radians, yaw starts getting distorted. I would be grateful if you could please provide some insight.

Many thanks,

@kriswiner
Copy link
Owner

kriswiner commented Apr 27, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 27, 2018

I saw in your code, you have accelgyrocalLSM9DS1() and magcalLSM9DS1() functions, I run it and move the chip in figure 8 and take average of the bias values, is it a correct way to do calibration ? will the calibration affect the orientation ?

The real question is:
I believe that the roll, pitch and yaw should be independent to each other. When you rotate the chip in one direction, for example pitch, the other two should stay nearly the same. When I do one complete rotation, yaw and pitch change by the same amount, (for example one complete rotation for yaw by 2 * pi radians also gives the same change for pitch). so what is the problem ?

@kriswiner
Copy link
Owner

kriswiner commented Apr 27, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 27, 2018

the max x and y axes seem to be aligned with the accel/gyro x and y axes. I also think the response of the madgwick filter may be delayed which may be causing the issue

@kriswiner
Copy link
Owner

kriswiner commented Apr 27, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 27, 2018

I can confirm mag x is accel/gyro -x, I am using esp arduino board... "..fusion rate at least 5x the sample rate", I have not tried this yet, let me have a try and get back to you. Do you think value of beta may also affect the rate?

@kriswiner
Copy link
Owner

kriswiner commented Apr 27, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 27, 2018

I can also confirm the fusion rate I get on ESP8266 board fluctuates slightly around 3.7 kHz (3.5kHz - 3.8 kHz)

@kriswiner
Copy link
Owner

kriswiner commented Apr 27, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 28, 2018

I use motionCal to calibrate my sensors please find my results as follows:
issue

@aa18514
Copy link
Author

aa18514 commented Apr 28, 2018

to be more specific as pitch goes from 0 degrees to -60 degrees, yaw goes from 0 to -40 degrees. However a change in pitch from 0 degrees to 60 degrees gives no change in yaw, as expected

@kriswiner
Copy link
Owner

kriswiner commented Apr 28, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 29, 2018

Dear Kris,

Many thanks for your support, I can confirm the following:

a) The Mahony and the Madgewick functions remain unchanged.

I believe the problem could potentially come from the calibration. What is interesting is that I tried using the same approach (i.e motionCal to calibrate) with Adafruit NXP 9 DOF (https://learn.adafruit.com/nxp-precision-9dof-breakout?view=all) and that seems to perform fine.

I believe that motionCal uses microTesla base units, which is why while calibrating lsm9ds1, I tried catering for this and made the appropriate changes, the following lines change from:

mx = (float)magCount[0] * mRes - magBias[0]
my = (float)magCount[1] * mRes - magBias[1]
mz = (float)magCount[2] * mRes - magBias[2]

to the following:
mx = mRes * (0.1f * (float) magCount[0] - magBias[0]);
my = mRes * (0.1f *(float) magCount[1] - magBias[1]);
mz = mRes * (0.1f * (float) magCount[2] - magBias[2]);

perhaps I am missing something else?

Best Wishes

@kriswiner
Copy link
Owner

kriswiner commented Apr 29, 2018 via email

@kriswiner
Copy link
Owner

kriswiner commented Apr 29, 2018 via email

@aa18514
Copy link
Author

aa18514 commented Apr 30, 2018

Dear Kris,

I can confirm that I am using the LSM6DS1 using MCU esp8266, I can also confirm that the data is being passed as radians/s to the fusion algorithm,

@kriswiner
Copy link
Owner

kriswiner commented Apr 30, 2018 via email

@aa18514
Copy link
Author

aa18514 commented May 18, 2018

Hi Kris,

Many thanks for your reply, I used a new LSM9DS1 chip and followed the same steps and everything seems to work. I consider the thread closed.

@aa18514 aa18514 closed this as completed May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants