Compare commits

...

3 Commits

Author SHA1 Message Date
Martin Krauser f0a3c9df44 add time info to accel msg 2022-03-04 14:07:54 +01:00
Martin Krauser 7c93796221 Merge branch 'master' of https://git.kompot.si/g1smo/pifcamp-2021 2022-03-04 14:06:41 +01:00
Martin Krauser 618547af52 Added the quaternion difference to qmsg 2022-03-04 13:39:40 +01:00
1 changed files with 13 additions and 3 deletions

View File

@ -58,6 +58,7 @@ uint8_t devStatus; // return status after each device operation (0 = succes
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount; // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer
uint32_t time = 0;
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
@ -160,15 +161,20 @@ void loop() {
#ifdef OUTPUT_READABLE_QUATERNION
// display quaternion values in easy matrix form: w x y z
Quaternion previousQ(q.w,q.x,q.y,q.z);
mpu.dmpGetQuaternion(&q, fifoBuffer);
//oscmsg = qOSC(q.w, q.x, q.y, q.z);
//compute the differential rotation between the previous and new orientation
Quaternion diff = q.getProduct(previousQ.getConjugate());
//oscmsg = qOSC(q.w, q.x, q.y, q.z, diff.w, diff.x, diff.y, diff,z);
qmsg.add(q.w);
qmsg.add(q.x);
qmsg.add(q.y);
qmsg.add(q.z);
SLIPBTSerial.beginPacket();
qmsg.send(SLIPBTSerial);
SLIPBTSerial.endPacket();
@ -227,10 +233,14 @@ void loop() {
#endif
// Send (accel) over serial
// Send (accel) and time elapsed over serial
int prevTime = time;
time = millis();
msg.add(AcX);
msg.add(AcY);
msg.add(AcZ);
msg.add(time - prevTime);
SLIPSerial.beginPacket();
msg.send(SLIPSerial);