Logic issue with Adafruit BNO055 & OSC

Hey all -

I’m running into an unknown (to me) issue trying to convert the logic from the Adafruit BNO055 orientation sensor to OSC (Open Sound Control)

Currently - no data is passed from the BNO055 to OSC. If I create a BNO055 to Serial sketch, it works fine. Separately, if I create an OSC sketch that sends arbitrary OSC values, that works fine as well. But for some reason when I combine the two, I get nothing.

My guess is that the data coming in from the BNO055 is in the wrong format and possibly at too fast a rate?

Thoughts appreciated. Thanks!

////////////////////////////////////////

/*
Adafruit BNO055 to OSC
2015-09-20
*/

#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <OSCBundle.h>

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

EthernetUDP Udp;

Adafruit_BNO055 bno = Adafruit_BNO055(55);

// Board IP
IPAddress ip(2, 0, 0, 100);
// Board MAC
byte mac = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// Destination IP
IPAddress outIp(2, 0, 0, 101);
// OSC Port
const unsigned int outPort = 8000;

void setup() {
Ethernet.begin(mac,ip);
Udp.begin(outPort);
}

void loop(){

sensors_event_t event;
bno.getEvent(&event);

OSCBundle bndl;

bndl.add("/axis/X").add((float)event.orientation.x);
bndl.add("/axis/Y").add((float)event.orientation.y);
bndl.add("/axis/Z").add((float)event.orientation.z);

Udp.beginPacket(outIp, outPort);
bndl.send(Udp); // send the bytes to the SLIP stream
Udp.endPacket(); // mark the end of the OSC Packet
bndl.empty(); // empty the bundle to free room for a new one

delay(1000);
}

I'm running into an unknown (to me) issue trying to convert the logic from the Adafruit BNO055 orientation sensor to OSC (Open Sound Control)

And that issue is?

Sorry! I went back and updated the info to explain my issue. Thanks!

Why is there no serial output in that sketch? Are you getting data from the sensor? What types are x, y, and z?

I did a test with a Serial output and the sensor data is good. Just seems to be some disconnect between sensor data and OSC? Thanks!

Just seems to be some disconnect between sensor data and OSC?

Seems to be a reasonable assumption. But, since you won't answer all the questions, you are on your own.

PaulS:
But, since you won't answer all the questions, you are on your own.

To answer all questions, yes - Data is coming from the sensor. What type of data is from the sensor, that I am not sure. My assumption is the Adafruit Sensor library and the OSC library expect different types of data and I am not sure what those data types are or how to convert them.

Thanks!

My assumption is the Adafruit Sensor library

It is not necessary to assume anything. You have the header file(s) for the sensor library. You can look and see what type event.orientation.x is. event is clearly of type sensors_event_t which is probably a typedef for a struct of some kind. But the type of orientation (probably another struct) and x, y, and z are unknown.

Now, when you printed x, y, and z, you should have gotten a clue. 3.14159 is not stored in an int.