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

Output Data #2

Open
flyboy74 opened this issue Aug 17, 2017 · 6 comments
Open

Output Data #2

flyboy74 opened this issue Aug 17, 2017 · 6 comments

Comments

@flyboy74
Copy link

I am trying to learn motion processing and have managed to write myself a driver for the MPU9250 9DOF sensor and now I need to implement Madgwick's filter to get accurate orientation. I see your MadgwickAHRS class with the update method but don't understand how the method returns the result.

@csvance
Copy link

csvance commented Mar 10, 2018

I had the same problem, here is the code snippet I used to get the position data back:

        heading = MadgwickAHRS()
        while True:
            ninedofxyz = self._ninedof.read()
            heading.update(ninedofxyz[0], ninedofxyz[2], ninedofxyz[1])
            ahrs = heading.quaternion.to_euler_angles()
            roll = ahrs[0]
            pitch = ahrs[1]
            yaw = ahrs[2]

However, the angles returned seem to be mostly nonsense so far. I think most likely I need to convert my gyroscope readings to rad/s and make sure everything is being sampled at the correct interval.

EDIT: after converting to correct units it seems to be working better now.

@Mattioli
Copy link

@csvance did you get the code to work fine? I'm using a visualizer to represent the object orientation to guarantee that the output is correct, but the differences on the movement and the visualizer are too big. Do you have any tips on which parameters/stuff you looked up to get everything working?

Thanks for the help.

@csvance
Copy link

csvance commented May 21, 2018

My problem was with how I was handling the gyroscope data from the IMU I was using. Everything was extremely unstable because (1) my unit conversion was not working as intended (2) I failed to calibrate my Gyroscope. The results should be usable if you make sure the data coming from your gyroscope is sane and calibrated, the accelerometer and magnetometer data gets normalized in Madgwick, so unless they are unstable you shouldn't have any problems with them.

I ended up using ROS for my application which includes a Madgwick node and everything works just fine.

@Mattioli
Copy link

Thanks for the answer! I've just found a mistake in my code and the results seem way better now.

@agamemnonc
Copy link

agamemnonc commented Jan 3, 2020

My problem was with how I was handling the gyroscope data from the IMU I was using. Everything was extremely unstable because (1) my unit conversion was not working as intended (2) I failed to calibrate my Gyroscope. The results should be usable if you make sure the data coming from your gyroscope is sane and calibrated, the accelerometer and magnetometer data gets normalized in Madgwick, so unless they are unstable you shouldn't have any problems with them.

I ended up using ROS for my application which includes a Madgwick node and everything works just fine.

Can you please clarify what you mean by "sane and calibrated"? I suppose you mean that gyroscope data must be converted to radians, but how do you calibrate? Thanks!

@CHOIBYUNGHUN
Copy link

@csvance thank you!! would you don't mind if you upload your code?? it really hard to me ㅠㅠ

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

5 participants