Open dsyleixa opened 6 years ago
ah, thanks, the bcm2835 perhaps was puzzling me... and does that also provide the fusioned yaw, pitch, and roll (Euler angles), not just the sole gyro and accelerometer values?
That example only has the raw accel/gryo data. Nobody as yet (that I know of) has put together an example that integrates any of the DMP code.
for the Arduino it's supposed to be availble, why not for the Pi?
The short answer is that porting the DMP code takes effort that nobody has put in for RasPi platforms yet, presumably due to low demand. Most of the interest around this chip and library has been in the small embedded MCU world.
I have sucessfully used the DMP on my raspi zero, i will provide an example (probably tomorrow), if you want that. But then there is a bug that the mpu6050 hang off when you use two i2c devices. You have to bitbang you other I2c devices then.
@ jrowberg :
:so do you think anyone will take the efforts to port the Arduino code for Euler angles to the Pi (IIRC, that is actually yaw, pitch, and roll) ? In a future that might be called "near"? ;)
2nd, does the Pi also use an interrupt pin? In case yes: which one?
@ Pluscrafter :
I have sucessfully used the DMP on my raspi zero, i will provide an example (probably tomorrow), if you want that. But then there is a bug that the mpu6050 hang off when you use two i2c devices. You have to bitbang you other I2c devices then. Thanks, that was cross-over-posting!
yes, I am interested, but I have always multiple i2c devices attached to my Pi which can't be bitbanged. I have also already i2c-0 in use at 400kHz, i2c-1 is running at 100kHz. So having said that, actually only a code will be working for me if it's fully i2c-compliant to additional different other devices.
It depends some I2c devices works with the mpu6050dmp, like the BMP180 or HMC1886l(don't have the exact number, is a magnetometer), but others like the pca9685 (DCA) seems not to work with the mpu6050 dmp and cause a freeze of the program.
Here is a example from Richardghirst, https://github.com/richardghirst/PiBits/tree/master/MPU6050-Pi-Demo there is a dmp example in there.
It depends some I2c devices works with the mpu6050dmp, like the BMP180 or HMC1886l(don't have the exact number, is a magnetometer), but others like the pca9685 (DCA) seems not to work with the mpu6050 dmp and cause a freeze of the program.
Do you know the reason why it fails? I have a GPS (Ublox Neo-Gy-6M), a OLED (http://hallard.me/adafruit-oled-display-driver-for-pi/), an MCP23017, 2 ASD1115 ADC, a PCA9685 Servo board, an Arduino slave (not working yet), a Real Time Clock RTC DS3231 , and some SRF-08 ultrasonic distance sensors.
Here is a example from Richardghirst, https://github.com/richardghirst/PiBits/tree/master/MPU6050-Pi-Demo there is a dmp example in there.
which is the file I need to c+p to my Geany IDE? Do I need extra compiler/linker flags?
edit: https://github.com/richardghirst/PiBits/blob/master/MPU6050-Pi-Demo/demo_dmp.cpp ? how does it retrieve and show yaw, pitch, and roll?
Do you know the reason why it fails? I have a GPS (Ublox Neo-Gy-6M), a OLED (http://hallard.me/adafruit-oled-display-driver-for-pi/), an MCP23017, 2 ASD1115 ADC, a PCA9685 Servo board, an Arduino slave (not working yet), a Real Time Clock RTC DS3231 , and some SRF-08 ultrasonic distance sensors.
When I get my logic analyzer in a couple days I try to localize the problem, but there were some issues in the past like (https://github.com/jrowberg/i2cdevlib/issues/252) i think this is the same issue, but it could also be the issue, that some libaries don't work together.
Here is a example from Richardghirst, https://github.com/richardghirst/PiBits/tree/master/MPU6050-Pi-Demo there is a dmp example in there.
which is the file I need to c+p to my Geany IDE? Do I need extra compiler/linker flags?
edit: Rhttps://github.com/richardghirst/PiBits/blob/master/MPU6050-Pi-Demo/demo_dmp.cpp ? how does it retrieve and show yaw, pitch, and roll?
`#ifdef OUTPUT_READABLE_YAWPITCHROLL // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); *printf("ypr %7.2f %7.2f %7.2f ", ypr[0] 180/M_PI, ypr[1] 180/M_PI, ypr[2] 180/M_PI);**
you can read the float ypr[] for the angles. This is more or less the same example like from jrowberg for the Arduino. And thanks to J.Rowberg for the libary, I use it for my quadcopter-flightcontroller, that should work in the future.
as to
#ifdef OUTPUT_READABLE_YAWPITCHROLL
(...)
printf("ypr %7.2f %7.2f %7.2f ", ypr[0] * 180/M_PI, ypr[1] * 180/M_PI, ypr[2] * 180/M_PI);
thanks - I completely missed the _YAWPITCHROLL part of the ifdef caption :o
I use it for my quadcopter-flightcontroller
very nice, I have 2 projects in progress for the MPU6050, a 7DOF robot arm (adjusting claw orientation+angle by the IMU, currently driven by a Adafruit M4 but which won't compile for that MCU yet), and an autonomous all terrain vehicle (alligning IMU yaw to GPS heading, currently driven by a Pi2).
(Perhaps 1 day also a quadrocopter coming...)
Does the Pi use an interrupt GPIO? https://github.com/richardghirst/PiBits/blob/master/MPU6050-Pi-Demo/demo_dmp.cpp in case yes, which one?
Does the Pi use an interrupt GPIO? https://github.com/richardghirst/PiBits/blob/master/MPU6050-Pi-Demo/demo_dmp.cpp in case yes, which one?
I think you can use Interrupts on all GPIO(expet for SDA/SDL and PowerPins), but i haven't use yet any interrupts.
No, sorry, you probably misunderstand me. I do not need to use interrupts for my purposes compellingly, but as the Arduino libs/sources are using interrupts (pin 2) I need to know if also the Pi libs/sources need them to be wired to or not.
no you dont have to wire the Interrupt pin.
BTW, what does that ......... wrapper mean for printf("ypr %7.2f %7.2f %7.2f ", ypr[0] 180/M_PI, ypr[1] 180/M_PI, ypr[2] * 180/M_PI); ?
http://www.dailyfreecode.com/code/formatted-output-real-numbers-2575.aspx
thanks, but that was just because of the double * around that line in your post - probably a text formatter.
**printf("ypr %7.2f %7.2f %7.2f ", ypr[0] * 180/M_PI, ypr[1] * 180/M_PI, ypr[2] * 180/M_PI);**
I deleted that post meanwhile because I saw what I was missing before, and printf is actually wellknown to me ;)
ah because there was a email notification for me.
@Pluscrafter on line 142 of demo_dpm.cpp has "else if (fifoCount> = 42)". I am testing the execution time on the Arduino and Raspberry Pi 3. The Arduino gets each dmp sample in 2ms while the rasp takes 50ms. In the degub, I verified that ficCount> = 42 takes an average of 69 iterations in the loop until you get a sample. Do you have any suggestions on how to reduce this time? Thanks
at which i2c clock speed are you running the Pi? (I always use 400k if possible). Which Arduino board are you trying? Uno, Zero, Due, SAMD51, ESP8266,ESP32 ?
Thanks @dsyleixa, I changed the -DDMP_FIFO_RATE flag to 0 in Makefile and it got a little better, but far from the performance that the Arduino achieves. I managed to catch 10ms. Fortunately, for my problem it is enough. I used the arduino uno.
hello, are there complete working code examples for Raspberry Pi 2 v1, Pi 2 v2, and Pi 3 (C++) available, e.g. for MPU6050 ? I don't find a Raspberry Pi section, similar to the Arduino section.