From db434f18b77a056746422ab7655f6851d6a9c0ec Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 4 Mar 2022 15:52:55 +0100 Subject: [PATCH] Sending quaternion differential as separate msg --- osc32bt/osc32bt.ino | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/osc32bt/osc32bt.ino b/osc32bt/osc32bt.ino index e0c74b8..7968784 100644 --- a/osc32bt/osc32bt.ino +++ b/osc32bt/osc32bt.ino @@ -84,7 +84,7 @@ OSCMessage msg("/accel/"); OSCMessage gmsg("/gyro/"); OSCMessage emsg("/error/"); OSCMessage kmsg("/keys/"); -OSCMessage qmsg("/quaternion/"); +OSCMessage quaternionMessage("/quaternion/"); void setup() { Wire.begin(); @@ -170,20 +170,36 @@ void loop() { //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); + quaternionMessage.add(q.w); + quaternionMessage.add(q.x); + quaternionMessage.add(q.y); + quaternionMessage.add(q.z); SLIPBTSerial.beginPacket(); - qmsg.send(SLIPBTSerial); + quaternionMessage.send(SLIPBTSerial); SLIPBTSerial.endPacket(); SLIPSerial.beginPacket(); - qmsg.send(SLIPSerial); + quaternionMessage.send(SLIPSerial); SLIPSerial.endPacket(); + + quaternionMessage.empty(); + + quaternionDiffMessage.add(diff.w); + quaternionDiffMessage.add(diff.x); + quaternionDiffMessage.add(diff.y); + quaternionDiffMessage.add(diff.z); + + SLIPBTSerial.beginPacket(); + quaternionDiffMessage.send(SLIPBTSerial); + SLIPBTSerial.endPacket(); + + SLIPSerial.beginPacket(); + quaternionDiffMessage.send(SLIPSerial); + SLIPSerial.endPacket(); + + quaternionDiffMessage.empty(); - qmsg.empty(); #endif