jufranz / perspection

perspection yo
0 stars 0 forks source link

Getting float values from the bno055 sensors #3

Closed shantanoo-desai closed 7 years ago

shantanoo-desai commented 7 years ago

Looking for help in bno055.h file in the platform/dev section. also i am using a different hardware device but the library is the BOMB! Any way I could print out floating values rather than integers?

Also your x,y,z buffer values seem off in bno055.c

The Adafruit Arduino Library for BNO055

 x = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8);
  y = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8);
  z = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8);

while as yours is (buffer indices):


  result.z = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8);
  result.x = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8);
  result.y = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8);
return result;
jvc1993 commented 7 years ago

Boi what?

Sent from my iPhone

On Aug 11, 2017, at 8:44 AM, Shan Desai notifications@github.com wrote:

Looking for help in bno055.h file in the platform/dev section.

Any way I could print out floating values rather than integers?

Also your x,y,z buffer values seem off in bno055.c

The Adafruit Arduino Library for BNO055

x = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8); y = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8); z = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8);

while as yours is (buffer indices):

result.z = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8); result.x = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8); result.y = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8); return result; — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

boztalay commented 7 years ago

To be marginally more helpful, I don't think we wrote that driver. Chances are we got it from Adafruit or something.

The buffer indices being different has a 73% chance of being a hack we did to rotate the axes.

If you want floating values instead of integers, I would just convert them in your application code (not the driver) by casting the integer values to a float and dividing by whatever the maximum integer value is.

Honestly though, none of us remember the details of this because we wrote it in 2 months working 15 hours a day, 2 years ago.

shantanoo-desai commented 7 years ago

I feel ya fam with the 15 hours a day thing. Thanks. :100: