kriswiner / MPU9250

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

pitch and roll locked #391

Open marcoarnold99 opened 5 years ago

marcoarnold99 commented 5 years ago

I've got a question: When I rotate the IMU around the z axis, the x and y axis stay in place and have always the same orientation relative to the outside world. Is there some ways to convert this in such a way, that pitch and roll always stay in the same place relative to the IMU? I've done it using a rotation matrix, but this is only somewhat accurate if the pitch and roll angle is below 45°. I don't really know which words to use to google for this problem.

I'm using the library from sparkfun, but since their code is based on this library and since the community is more active here, I'm asking the question here.

kriswiner commented 5 years ago

Confused.

If you rotate about the z-axis, isn't it the z-axis that is stationary? How can the x- and y-axes "stay in place"?

On Wed, Oct 2, 2019 at 8:19 AM Papierkor654 notifications@github.com wrote:

I've got a question: When I rotate the IMU around the z axis, the x and y axis stay in place and have always the same orientation relative to the outside world. Is there some ways to convert this in such a way, that pitch and roll always stay in the same place relative to the IMU? I've done it using a rotation matrix, but this is only somewhat accurate if the pitch and roll angle is below 45°. I don't really know which words to use to google for this problem.

I'm using the library from sparkfun, but since their code is based on this library and since the community is more active here, I'm asking the question here.

— 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/391?email_source=notifications&email_token=ABTDLKWKGCGCUYD3YFQLMNLQMS3ZTA5CNFSM4I4XZLTKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HPFFPSQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKVKLSSWYWU2TCY54U3QMS3ZTANCNFSM4I4XZLTA .

marcoarnold99 commented 5 years ago

Exactly that is my problem, if the x axis is parallel to a line drawn from the north to the south pole and then the IMU is rotated around the z axis, the x axis was still parallel to the line mentioned before. So the x and y axis don't rotate with the z axis.

kriswiner commented 5 years ago

Sounds like either:

0) you are not configuring your sensor properly (are you seeing reasonable accel, gyro, and mag values? How do you know?)

1) your sensor is broken (do all sensor axes respond reasonably?)

2) your sensor is not calibrated (How did you calibrate it?)

3) You are not loading the sensor dat into the sensor fusion filter properly

4) all of the above.

3)

On Wed, Oct 2, 2019 at 8:49 AM Papierkor654 notifications@github.com wrote:

Exactly that is my problem, if the x axis is parallel to a line drawn from the north to the south pole and then the IMU is rotated around the z axis, the x axis was still parallel to the line mentioned before. So the x and y axis don't rotate with the z axis.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/391?email_source=notifications&email_token=ABTDLKX3GRPVOREVEEJJSV3QMS7HNA5CNFSM4I4XZLTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAFHNNI#issuecomment-537556661, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKTLWJHOFK3EUBCRXQTQMS7HNANCNFSM4I4XZLTA .

marcoarnold99 commented 5 years ago

The angles are correct as far as I can see. With the transformation mentioned above I've even managed to stabilize a drone. But because this transformation causes the angles to be wrong beyond 45° the drone crashes if it's to much angled.

How would I calibrate the IMU? I didn't do this. I thought only the magnetometer has to be calibrated due to the magnetic declination.

kriswiner commented 5 years ago

All the sensors need to be calibrated. Otherwise they will not be accurate.

On Wed, Oct 2, 2019 at 8:57 AM Papierkor654 notifications@github.com wrote:

The angles are correct as far as I can see. With the transformation mentioned above I've even managed to stabilize a drone. But because this transformation causes the angles to be wrong beyond 45° the drone crashes if it's to much angled.

How would I calibrate the IMU? I didn't do this. I thought only the magnetometer has to be calibrated due to the magnetic declination.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/391?email_source=notifications&email_token=ABTDLKUBH4RC6SKUYL4ZR6DQMTAG3A5CNFSM4I4XZLTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAFILVA#issuecomment-537560532, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKT4FYQ45Z6OIH3FYQDQMTAG3ANCNFSM4I4XZLTA .

marcoarnold99 commented 5 years ago

Ok, thanks for your help ^^ I probably should to this to make sure to have to highest accuracy possible. But in my case everything is accurate at the very least to +-5° except for the fact that the x and y axis stay still. I think this can't really be an accuracy issue.

kriswiner commented 5 years ago

Likely a software error, I thought you said your UAV flies...it shouldn't.

Are the sensor values reasonable? if you change orientation, do you see gravity on all thee accel axes, for example, etc?

On Wed, Oct 2, 2019 at 9:08 AM Papierkor654 notifications@github.com wrote:

Ok, thanks for your help ^^ I probably should to this to make sure to have to highest accuracy possible. But in my case everything is accurate at the very least to +-5° except for the fact that the x and y axis stay still. I think this can't really be an accuracy issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/391?email_source=notifications&email_token=ABTDLKTTPWWDA2UBISTERFLQMTBP5A5CNFSM4I4XZLTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAFJQVA#issuecomment-537565268, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKUNMGPKZ4LY7IYLGSLQMTBP5ANCNFSM4I4XZLTA .