wizofe / bluewand-python

SOAI (Tiny Open Source API) to speak with the KANO Wand
GNU General Public License v3.0
16 stars 3 forks source link

Guidance for the sensor data values? #6

Open bri365 opened 5 years ago

bri365 commented 5 years ago

Hello!

I forked the repo and am starting to process the incoming data from the wand. Do you have any guidance and/or sample code that could point me in the right direction for interpreting the data?

Seems like each packet comprises 9 signed int16 values, and my first guess is accelerometer, gyro, then magnetometer data. The data also seems to be already processed into signed values, so some offset has been applied to the ADC.

Hoping to not have to figure this all out the hard way :-)

Regards,

Brian

wizofe commented 5 years ago

Hi @bri365! :)

Thanks for your interest. Indeed you can get two different outputs:

Let me know if you need anything else. Unfortunately, I can't make sense of the raw data myself :) Also @ukbaz is working on making sense of the data as well.

ukBaz commented 5 years ago

My current understanding on this is that 64a70002-f691-4b93-a6f4-0968f5b648f8 is the Quaternions and that it consists of 4 sint16 being reported. I have been taking two octets and converting them with the following:

int.from_bytes(value, byteorder='little', signed=True) / 1000

I have been using https://quaternions.online/ to visualise the output. My current assumption is that the order is w, x, y & z

wizofe commented 5 years ago

Sorry, it was a typo :man_facepalming: That's right as @ukBaz says, quaternions are by convention coming on w,x,y,z!

Indeed it's 4xint16.

Also 64A7000A-F691-4B93-A6F4-0968F5B648F8 is the 9-axis raw data and 64A70002-F691-4B93-A6F4-0968F5B648F8 are the quaternions.

Furthermore, if you need to play with the RGB LED values, there's an R/W Characteristic: 64A70009-F691-4B93-A6F4-0968F5B648F8. The values are as following:

Format: uint8[3]
Minimum Value: 0,RGB565
Maximum Value: 7,RGB565

The way it works is that there are 6 pre-set RGB LED Patterns by the firmware Non-zero write to characteristic triggers the sequence followed by the color value in RGB 565 format ;)