Go Down

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

dsyleixa

I just got the advice that it might be a macro and so to add to the source code

#ifndef _BV
#define _BV(n) (1<<(n))
#endif


But after that, now it still doesn't compile for M0 and/or M4, with new error messages:

source: https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino
Code: [Select]

Arduino: 1.8.5 (Windows 7), Board: "Adafruit Feather M4 Express (SAMD51), Enabled"

D:\arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\arduino\hardware -hardware D:\arduino\portable\packages -tools D:\arduino\tools-builder -tools D:\arduino\hardware\tools\avr -tools D:\arduino\portable\packages -built-in-libraries D:\arduino\libraries -libraries D:\Arduino\portable\libraries -fqbn=adafruit:samd:adafruit_feather_m4:cache=on -ide-version=10805 -build-path C:\Users\LOKALE~1\AppData\Local\Temp\arduino_build_81307 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.openocd.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.CMSIS.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-Atmel.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.bossac.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -verbose D:\Akten\Programmierung\arduinoProgs\driver\MPU6050-h-Examples\MPU6050_DMP6_002\MPU6050_DMP6_002.ino
D:\arduino\arduino-builder -compile -logger=machine -hardware D:\arduino\hardware -hardware D:\arduino\portable\packages -tools D:\arduino\tools-builder -tools D:\arduino\hardware\tools\avr -tools D:\arduino\portable\packages -built-in-libraries D:\arduino\libraries -libraries D:\Arduino\portable\libraries -fqbn=adafruit:samd:adafruit_feather_m4:cache=on -ide-version=10805 -build-path C:\Users\LOKALE~1\AppData\Local\Temp\arduino_build_81307 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.openocd.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.CMSIS.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-Atmel.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.bossac.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -verbose D:\Akten\Programmierung\arduinoProgs\driver\MPU6050-h-Examples\MPU6050_DMP6_002\MPU6050_DMP6_002.ino
Using board 'adafruit_feather_m4' from platform in folder: D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3
Using core 'arduino' from platform in folder: D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3
WARNUNG: Kategorie '' in der Bibliothek XPT2046 ist ungültig und wird auf 'Uncategorized' festgelegt
Build-Optionen wurden verändert, alles wird neu kompiliert
(...)

Sketch wird kompiliert...
(...)

              from C:\Users\LOKALE~1\AppData\Local\Temp\arduino_build_81307\sketch\MPU6050_DMP6_002.ino.cpp:1:

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/HardwareSerial.h:71:18: warning: unused parameter 'baudrate' [-Wunused-parameter]

  virtual void begin(unsigned long baudrate, uint16_t config) {}

               ^

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/HardwareSerial.h:71:18: warning: unused parameter 'config' [-Wunused-parameter]

In file included from D:\Akten\Programmierung\arduinoProgs\driver\MPU6050-h-Examples\MPU6050_DMP6_002\MPU6050_DMP6_002.ino:54:0:

D:\Arduino\portable\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:743:9: warning: unused parameter 'dmpData' [-Wunused-parameter]

uint8_t MPU6050::dmpProcessFIFOPacket(const unsigned char *dmpData) {

      ^

Compiling libraries...
(...)
          #warning Using current Arduino IDE with Wire library is functionally limiting.

           ^

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:65:14: warning: #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended. [-Wcpp]

          #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended.

           ^

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:66:14: warning: #warning This I2Cdev implementation does not support: [-Wcpp]

          #warning This I2Cdev implementation does not support:

           ^

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:67:14: warning: #warning - Timeout detection (some Wire requests block forever) [-Wcpp]

          #warning - Timeout detection (some Wire requests block forever)

           ^

In file included from D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/Arduino.h:78:0,

              from D:\Arduino\portable\libraries\I2Cdev\I2Cdev.h:77,

              from D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:46:

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/HardwareSerial.h:71:18: warning: unused parameter 'baudrate' [-Wunused-parameter]

  virtual void begin(unsigned long baudrate, uint16_t config) {}

               ^

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/HardwareSerial.h:71:18: warning: unused parameter 'config' [-Wunused-parameter]

In file included from D:\Arduino\portable\libraries\I2Cdev\I2Cdev.h:77:0,

              from D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:46:

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope

          for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {

                                                           ^

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/Arduino.h:100:24: note: in definition of macro 'min'

#define min(a,b) ((a)<(b)?(a):(b))

                     ^

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':

D:\Arduino\portable\libraries\I2Cdev\I2Cdev.cpp:414:70: error: 'BUFFER_LENGTH' was not declared in this scope

          for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {

                                                                   ^

D:\arduino\portable\packages\adafruit\hardware\samd\1.2.3\cores\arduino/Arduino.h:100:24: note: in definition of macro 'min'

#define min(a,b) ((a)<(b)?(a):(b))

                     ^

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 Feather M4 Express (SAMD51).

dsyleixa

update:
with some lib source fixes now the example from https://github.com/jrowberg/i2cdevlib also compiles for ARM Cortex M0 and M4 cpus,.
By theory, it also provides yaw, pitch, and roll.
Unfortunately the program often hangs up and gets stuck, it also needs an interrupt pin (which is actualy a problem because my Adafruit boards have extremely few free pins), and the calculated yaw value is still sort of unstable.

Does someone know a different lib which provides yaw, pitch, and roll and which is suitable for ARM cores, too?

dsyleixa

update 2:

some issues could be resolved for the DMP6 example (MPU in dmp mode):
- It takes quite long (30 - 40 sec ) until either yaw start value settles.
- After having settled, an actual "stabile yaw start value" varies randomly, completely different to either other one , mostly in a range +30°...-170°
- when once having settled, then the calculations of turning/rotating back and forth always end up at quite stable trustworthy yaw values, relative to the start value.
- for dmp mode an interrupt pin is required
- IMU drift is partially about -1.5° per 5 min, partially much less  (-4° / 30min)

bitbank

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.
Maybe different wording will help @dsyleixa with his lack of understanding of the situation:
When an IMU is perfectly still, the pitch and roll can be calculated precisely because gravity provides a point of reference for the Z axis. The gyroscope is imperfect and will drift. If you rely 100% on the gyroscope for pitch/roll, it will soon have nonsense values (especially with $0.45 parts like the MPU-6050).
To get an accurate yaw angle, you need a point of reference which is 90 degrees rotated from gravity. The magnetic poles do a good job of this. Without a point of reference, you have NO WAY OF EVER CALCULATING an accurate yaw angle. If you start from a known position and just use Z axis rotation of the gyroscope to calculate the yaw angle, you'll quickly have a value that is wrong.
You keep claiming to know nothing about Kalman filters, raw values, libraries, etc. It would help you to understand if you took the time to learn how an accelerometer + gyroscope work so that you can understand the information provided and its limitations.
Library? We don't need no stinkin' library...we write our own

dsyleixa

Quote
The magnetic poles do a good job of this.
no, as already stated several times, the magnetc poles are not suitable for that purpose, because of many strong external and on-board magnetic sources of interference of unpredictable strengths and directions.
Magnetic headings by magnetometers often fluctuate up to +/- 180° within several seconds in my environments.
But if you read closely, the issue is meanwhile resolved by using the MPU6050 onboard dmp, thank you!

jremington

Quote
the issue is meanwhile resolved by using the MPU6050 onboard dmp
Not at all, for those interested in obtaining an absolute orientation.

But you are certainly welcome to continue deluding yourself.

dsyleixa

I do not need an absolute orientation, I stated that already probably a hundred times: just stabilized (filtered) yaw, pitch, and roll values. If in doubt, see post #3.
And now please stop trolling and move on.

jremington

Not trolling, I just want to make sure that others aren't confused by your confusion.

dsyleixa

I  NEVER stated that I would need absolute values.
Just relative yaw to an arbitrary initial one.
YOU are the one who repeatedly is trolling, sabotaging and confusing all and everything by your repeated off-topic posts.

jremington

You can't get long term stable values for yaw, without using some sort of external reference. Perhaps the values you get, that are stable for only a short term, are OK for your purposes.

dsyleixa

You can't get long term stable values for yaw, without using some sort of external reference. Perhaps the values you get, that are stable for only a short term, are OK for your purposes.
Yes, I know that, I knew that already from the start, and I never doubted that.

Go Up