kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.03k stars 471 forks source link

Creating a 3D simulation using the MPU9250_BMP280_BasicAHRS_t3.ino sketch #263

Open maxerbox opened 6 years ago

maxerbox commented 6 years ago

Dear,

I'm a highschool student, and I have to make a robot as a final exam project. I'm in charge of the robot's orientation & Bluetooth transmission. So, in oder to perfom that task, we bough an IMU 10DOF Grove from seed studio, which works with a MPU9250 device. I have searched "How can I get the orientation using an IMU board?", and discovered the Madgwick filter (I don't understand the maths, it's beyond me)

In order to get the orientation, I forked one of your skecth, MPU9250_BMP280_BasicAHRS_t3.ino.

I have made some changes to the Arduino Sketch:

For the 3D simulation part, I'm using Processing, a visual art language based on java.

Here is a video of my experiment : Video

The source code (Arduino & processing sketch) is available at : https://github.com/RISE-Project-STI2D/3D-Orientation-IMU-10DOF-MPU9250-Test-Grove

It is actually working, my problem is: I don't get the same orientation as my display. It's sort of inverted, when I rotate the IMU in a direction, on the display it rotates to another direction What I'm looking for, is just to synchronize the IMU orientation with the display, and make them correspond when you rotate, like this video.

I was wondering if it was related to a NED frame, or something else. Do you have an idea on the problem ?

kriswiner commented 6 years ago

No idea.

I would first make sure the heading pitch and roll makes sense on the board output. If you point the board toward North, do you see heading of ~0 degrees? if you then point it Eastward, do you see 90 degree?

If you face the board up, do you read 0 degrees for pitch and 180 degrees for roll? When you tip Eastern part of the board upward, does roll become more positive?

When you dip the North end of the board downward, does the pitch become negative?

Simple tests to see if you have the AHRS implemented properly on the board. If so, then yes, there could be a mismatch between the coordinate systems of the board and the display.

On Sun, Apr 8, 2018 at 7:33 AM, Simon Sassi notifications@github.com wrote:

Dear,

I'm a highschool student, and I have to make a robot as a final exam project. I'm in charge of the robot's orientation & Bluetooth transmission. So we bough an IMU 10DOF Grove http://wiki.seeedstudio.com/Grove-IMU_10DOF_v2.0/from seed studio, which works with a MPU9250 device. I have searched "How can I get the orientation using an IMU board?", and discovered the Madgwick filter (I don't understand the maths, it's beyond me)

In order to get the orientation, I forked one of your skecth, MPU9250_BMP280_BasicAHRS_t3.ino https://github.com/kriswiner/MPU9250/blob/master/MPU9250_BMP280_BasicAHRS_t3.ino .

I have made some changes to the Arduino Sketch:

  • In order to receive the orientation & some infos, the arduino board print serial normalized infos (Yaw, pitch, roll.
  • I've made a new var for the informations printing interval.

For the 3D simulation part, I'm using processing, Processing https://processing.org/, a visual art language based on java.

Here is a video of my experiment : [image: Video] https://streamable.com/nwq73

The source code (Arduino & processing sketch) is available at : https://github.com/RISE-Project-STI2D/3D-Orientation- IMU-10DOF-MPU9250-Test-Grove

It is actually working, my problem is: I don't get the same orientation as my display. It's sort of inverted, when I rotate the IMU in a direction, on the display it rotates to another direction What I'm looking for, is just to synchronize the IMU orientation with the display, and make them correspond when you rotate, like this video https://www.youtube.com/watch?v=BXsGWoOMtmU.

I was wondering if it was related to a NED frame, or something else. Do you have an idea on the problem ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/263, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qsfLHXiBdl5LNIqnMVNxiwDEA9Chks5tmh-kgaJpZM4TLj9f .

maxerbox commented 6 years ago

If you point the board toward North, do you see heading of ~0 degrees? if you then point it Eastward, do you see 90 degree?

I'm not always getting the same value. If I manage to get 0° heading by orientating the board, and then turn to it by 90°, I get ~130° (I should get 90° normally ?). I have remade a test and I get an angle of 80° by rotating it to 90°. That's unstable.

If you face the board up, do you read 0 degrees for pitch and 180 degrees for roll?

If I face the board up, I get a pitch of ~0°, and a roll of ~0° If I face the board down, I get a pitch of ~0°, and a roll of ~180° (it seems inverted)

When you tip Eastern part of the board upward, does roll become more positive?

Roll become more negative

When you dip the North end of the board downward, does the pitch become negative?

Yes

kriswiner commented 6 years ago

This all seems fine to me, maybe there is a mismatch in your graphics routine.

On Mon, Apr 9, 2018 at 4:26 AM, Simon Sassi notifications@github.com wrote:

If you point the board toward North, do you see heading of ~0 degrees? if you then point it Eastward, do you see 90 degree? I'm not always getting the same value. ~~If I manage to get 0° heading by orientating the board, and then turn to it by 90°, I get 130° (I should get 90° normally ?). I have remade a test and I get an angle of 80° by rotating it to 90°. That's unstable.

If you face the board up, do you read 0 degrees for pitch and 180 degrees for roll? If I face the board up, I get a pitch of ~0°, and a roll of ~0° If I face the board down, I get a pitch of ~0°, and a roll of ~180° (it seems inverted) When you tip Eastern part of the board upward, does roll become more positive? Roll become more negative When you dip the North end of the board downward, does the pitch become negative? Yes

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/263#issuecomment-379720000, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qp1vnP_wUoK3bchYW3Hkl3Y8tk6vks5tm0VpgaJpZM4TLj9f .

maxerbox commented 6 years ago

Basically I have to align my display with the North to get matching positions, is that right ?

Le lun 9 avr. 2018 18:28, Kris Winer notifications@github.com a écrit :

This all seems fine to me, maybe there is a mismatch in your graphics routine.

On Mon, Apr 9, 2018 at 4:26 AM, Simon Sassi notifications@github.com wrote:

If you point the board toward North, do you see heading of ~0 degrees? if you then point it Eastward, do you see 90 degree? I'm not always getting the same value. ~~If I manage to get 0° heading by orientating the board, and then turn to it by 90°, I get 130° (I should get 90° normally ?). I have remade a test and I get an angle of 80° by rotating it to 90°. That's unstable.

If you face the board up, do you read 0 degrees for pitch and 180 degrees for roll? If I face the board up, I get a pitch of ~0°, and a roll of ~0° If I face the board down, I get a pitch of ~0°, and a roll of ~180° (it seems inverted) When you tip Eastern part of the board upward, does roll become more positive? Roll become more negative When you dip the North end of the board downward, does the pitch become negative? Yes

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kriswiner/MPU9250/issues/263#issuecomment-379720000 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AGY1qp1vnP_wUoK3bchYW3Hkl3Y8tk6vks5tm0VpgaJpZM4TLj9f

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/263#issuecomment-379812237, or mute the thread https://github.com/notifications/unsubscribe-auth/AMLKswX9hR4mXzJyL_UYUSr9O0E5uhY7ks5tm4wmgaJpZM4TLj9f .

kriswiner commented 6 years ago

Sounds like it might be.

On Sun, Apr 29, 2018 at 6:01 AM, Simon Sassi notifications@github.com wrote:

Basically I have to align my display with the North to get matching positions, is that right ?

Le lun 9 avr. 2018 18:28, Kris Winer notifications@github.com a écrit :

This all seems fine to me, maybe there is a mismatch in your graphics routine.

On Mon, Apr 9, 2018 at 4:26 AM, Simon Sassi notifications@github.com wrote:

If you point the board toward North, do you see heading of ~0 degrees? if you then point it Eastward, do you see 90 degree? I'm not always getting the same value. ~~If I manage to get 0° heading by orientating the board, and then turn to it by 90°, I get 130° (I should get 90° normally ?). I have remade a test and I get an angle of 80° by rotating it to 90°. That's unstable.

If you face the board up, do you read 0 degrees for pitch and 180 degrees for roll? If I face the board up, I get a pitch of ~0°, and a roll of ~0° If I face the board down, I get a pitch of ~0°, and a roll of ~180° (it seems inverted) When you tip Eastern part of the board upward, does roll become more positive? Roll become more negative When you dip the North end of the board downward, does the pitch become negative? Yes

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kriswiner/MPU9250/issues/263# issuecomment-379720000 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AGY1qp1vnP_ wUoK3bchYW3Hkl3Y8tk6vks5tm0VpgaJpZM4TLj9f

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/kriswiner/MPU9250/issues/263#issuecomment-379812237 , or mute the thread https://github.com/notifications/unsubscribe-auth/AMLKswX9hR4mXzJyL_ UYUSr9O0E5uhY7ks5tm4wmgaJpZM4TLj9f .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/263#issuecomment-385249909, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qqAaCiAMZO5mxvb4StiqBlnVx2UXks5ttbmogaJpZM4TLj9f .