hello guys,
i have issue mpu-6050.
i work library jeff rowberg - should famous think.
now tried dmp-example readable_quaternion. z-axis works fine , without latency. x/y - axis slow , cant used project. there way make latency-free?
i have issue mpu-6050.
i work library jeff rowberg - should famous think.
now tried dmp-example readable_quaternion. z-axis works fine , without latency. x/y - axis slow , cant used project. there way make latency-free?
code: [select]
void loop() {
// if programming failed, don't try anything
if (!dmpready) return;
// wait mpu interrupt or packet(s) available
while (!mpuinterrupt && fifocount < packetsize) {
// other program behavior stuff here
// .
// .
// .
// if paranoid can test in between other
// stuff see if mpuinterrupt true, , if so, "break;" the
// while() loop process mpu data
// .
// .
// .
}
// reset interrupt flag , int_status byte
mpuinterrupt = false;
mpuintstatus = mpu.getintstatus();
// current fifo count
fifocount = mpu.getfifocount();
// check overflow (this should never happen unless our code inefficient)
if ((mpuintstatus & 0x10) || fifocount == 1024) {
// reset can continue cleanly
mpu.resetfifo();
serial.println(f("fifo overflow!"));
// otherwise, check dmp data ready interrupt (this should happen frequently)
} else if (mpuintstatus & 0x02) {
// wait correct available data length, should short wait
while (fifocount < packetsize) fifocount = mpu.getfifocount();
// read packet fifo
mpu.getfifobytes(fifobuffer, packetsize);
// track fifo count here in case there > 1 packet available
// (this lets read more without waiting interrupt)
fifocount -= packetsize;
#ifdef output_readable_quaternion
// display quaternion values in easy matrix form: w x y z
mpu.dmpgetquaternion(&q, fifobuffer);
serial.print("quat\t");
serial.print(q.w);
serial.print("\t");
serial.print(q.x, 6);
serial.print("\t");
serial.print(q.y, 6);
serial.print("\t");
serial.println(q.z, 6);
#endif
i recommend rtimulib for arduino. state of art , works sensor.
Arduino Forum > Using Arduino > Sensors > MPU-6050 slow X/Y Quaternion
arduino
Comments
Post a Comment