Go Down

Topic: which MPU6050 libs for ARM core (with Kalman filter?) and without Intr usage ? (Read 1 time) previous topic - next topic

dsyleixa

...
Having said that, I want to show you a link about a lib which claims to calculate both yaw, pitch, and roll, but as stated, I can't say anything about trustworthiness or interrupts if yes or no:
https://github.com/jarzebski/Arduino-MPU6050/blob/master/MPU6050_gyro_pitch_roll_yaw/MPU6050_gyro_pitch_roll_yaw.ino
I hope that might help you further, or some other people can comment on this perhaps!

thanks for your hint, I just tried it out.
Unfortunately the example sketch MPU6050_DMP6 does not compile for me, neither for my Due, nor for my M0, and nor for my M4.
(No board manager issues, because different other sketches still compile for these boards very will without issues).

So thanks again, but I'm afraid that some other libs are required instead ... :-/

MarkT

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dsyleixa

Presumably you've seen https://playground.arduino.cc/Main/MPU-6050
please help me - where is that supposed to calculate yaw, pitch and roll?
All I can see thers are sole gyro and sole accel values, no sensor fusion, no Kalman filtering, and no 3-dim coordinate system transformations from local sensor to global aeronautic orientation.
Notice that e.g. for pitch=0 and roll=0° then the gyro z axis is significant for yaw, whilst for pitch=+80° then mainly the x axis becomes more significant to yaw. Same for e.g. roll=80°, then the y axis becomes most significant to yaw. So the problem about 3D coordinate system transformations is not trivial, and additionally the raw sensor values surely will have to be filtered (some are using extended Kalman filters to accel and gyros against gaussian and non-gaussian noise and high pass filters to eliminate drift).

Idahowalker

This might help https://forum.arduino.cc/index.php?topic=501334.0.

It is possible to determine angle of offset by using acceleration, I have my MPU 6050 sitting on a X/Y table that is kept level by taking acceleration converted angles and turning them into torque values for the X/Y servos.

It is possible to measure the X/Y/Z, MPU6050 Gyro and Accelerometers, drift rate and offsets (the Z axis must be physically aligned to the North Pole during calibration), which I have done on a RPi in Python, and apply those drift rates and offsets to the accelerometers, which, for the Z axis accelerometer gets rid of the earths rotation value. Using the Z axis accelerometer positioned so that the accelerometer is not detecting any acceleration (N-Pole aligned) and the X/Y are allowed, by being on a stable platform, to be gravity aligned, a local coordinate system is realized; +X+Y, -X+Y, -X,-Y, +X-Y, and Yaw can be determined from the acceleration vectors. The Z axis can be torqued so that any felt acceleration is zeroed out, keeping the Z axis pointed to the North Pole. The position on the Earth Geodesic can determined by Trigonometry, using the meridian coordinate system and then converted to Lat and Lon. With Lat and Lon increments you can, also, determine Yaw, negating the need for a Z Axis measurement.

I have posted the Python code I use to develop XY angles from acceleration, here in these forums, in the past. I figured someone has ported the code to CPP by now; *shrug*

I know it is not the instant answer solution to your issue but it is what I got. I, should, in a few months look to make my X/Y platform into a X/Y/Z platform, with Z stabilized to the North Pole but I am working on something else at the moment.

Good luck.

dsyleixa

thank you for your post, as I understand it's theoretically possibe to achieve the functionality I wish to have.
At some point it sounds as if you use different x,y,z, coordinate axis designations than I did, but in principle that makes no difference of course.

longitudinal =x
transverse = y
vertical = z

As stated, again: I do not need absolute magnetic compass headings, just relative ones to an arbitrary start value.

So far I am using this lib for pitch and roll:
https://github.com/TKJElectronics/KalmanFilter/tree/master/examples

Unfortunately it does not show yaw yet, and so a different lib is desired for download and install.
 

dsyleixa

that's really weird that no one knows a working yaw+pitch+roll lib for the MPU6050 and an ARM core MCU... :-/

Idahowalker



As stated, again: I do not need absolute magnetic compass headings, just relative ones to an arbitrary start value.

Unfortunately it does not show yaw yet, and so a different lib is desired for download and install.
 
If you are using a MPU5060 you have the ability to calculate your relative heading.
I am not going to tell you how to do it. Your image you post is the clue.

Look at your image. Your image represents a X, Y, Z 3D coordinate system. Think of a XY graph plot on a piece of paper. Actualy, just do that now, draw a vert and horz line on a sheet of paper with the lines intersecting at a 90 degree angle. Where the lines intersect that is the relative current position. If you plot a dot on the +X+Y of 1 unit up and one unit over. Now plot another point 2 units up and 2 units over, and 3 units up and 3 units over, and 4 units up and 4 units over... You should end up with a line that from +X,+Y is at 45 degrees, which is your relative heading.

The mpu6050 gives you +/- Accelerations. Those accelerations are your direction of travel vectors that can be used to determine relative heading. It's just simple math, You can do it yourself.

dsyleixa

sorry, I can't, I need a lib to retrive yaw, pitch, and roll, incl. filtering, I don't understand anything of the raw values and the Kalman and quaternions and Euler angles and sensor fusion and whatever. And BTW, for horizontal positions or 90° rotated, the accelerations are not helpful for yaw at all, just specific and vaying gyro values, and only for in-between  tilt values the vectors have to be somehow composed for sensor fusion - but how or by which transformations is absolutely beyond me.
There are libs which provide pitch and roll, but no yaw unfortunately, and some claim to provide yaw, too, but don't compile at all for my ARM boards. I really cannot understand why a really working lib  doesn't already exist. :-/

jremington

Quote
I really cannot understand why a really working lib  doesn't already exist
See reply #2: You need a magnetometer for stable yaw values. The MPU6050 does not have one.

The MPU6050 library developers understand this simple point.

dsyleixa

See reply #2: You need a magnetometer for stable yaw values. The MPU6050 does not have one.

The MPU6050 library developers understand this simple point.
first I just need simply yaw, and that must be possible.
 I told you dozens of times why a magnetometer wouldn't work for my purposes, so don't keep posting over and over the same nonsense!

dsyleixa

I also tried
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino

but there I get the errors

Code: [Select]
Bibliothek I2Cdev im Ordner: D:\Arduino\portable\libraries\I2Cdev (legacy) wird verwendet
Bibliothek Wire in Version 1.0 im Ordner: D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\libraries\Wire  wird verwendet
Bibliothek MPU6050 im Ordner: D:\Arduino\portable\libraries\MPU6050 (legacy) wird verwendet
exit status 1
Fehler beim Kompilieren für das Board Adafruit ItsyBitsy M0.

dsyleixa

I also tried
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino

but there I get the errors

Code: [Select]
Bibliothek I2Cdev im Ordner: D:\Arduino\portable\libraries\I2Cdev (legacy) wird verwendet
Bibliothek Wire in Version 1.0 im Ordner: D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\libraries\Wire  wird verwendet
Bibliothek MPU6050 im Ordner: D:\Arduino\portable\libraries\MPU6050 (legacy) wird verwendet
exit status 1
Fehler beim Kompilieren für das Board Adafruit ItsyBitsy M0.


same for the M4:
Code: [Select]
exit status 1
Fehler beim Kompilieren für das Board Adafruit Feather M4 Express (SAMD51).



why are there those compile errors for the ARM cores?

dsyleixa

how disappointing that actually no working motion processing libs exist which compile for ARM  cpus, too - and noone actually is able to fix those issues...

dsyleixa

now I reinstalled a new MPU6050 lib from https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050
and used this example
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino

and now there's the error for both the Arduino Due, M0 (Adafruit Itsybitsy M0), and M4 (Adafruit Feather M4):

Code: [Select]
MPU6050_DMP6:279: error: '_BV' was not declared in this scope
    if ((mpuIntStatus & _BV(MPU6050_INTERRUPT_FIFO_OFLOW_BIT)) || fifoCount >= 1024) {
                                                            ^
Bibliothek I2Cdev im Ordner: D:\Arduino\portable\libraries\I2Cdev (legacy) wird verwendet
Bibliothek Wire in Version 1.0 im Ordner: D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\libraries\Wire  wird verwendet
Bibliothek MPU6050 im Ordner: D:\Arduino\portable\libraries\MPU6050 (legacy) wird verwendet
exit status 1
'_BV' was not declared in this scope


what is going on here?

 (edit: for Mega2560 it can be compiled though, so how can that be fixed for ARM cpus?)

tito-t

Seems to be similar to last reported issue about https://github.com/jarzebski/Arduino-MPU6050/blob/master/MPU6050_gyro_pitch_roll_yaw/MPU6050_gyro_pitch_roll_yaw.ino which I once suggested.  I also don't really understand that and can't fix that, but to me that looks as if it was a bare-metal AVR register or something like that, no idea why one can't use Arduino API expressions instead for this pupose which then would work for all Arduino boards...?.

Go Up