#### Bosch Sensortec Community

cancel
Showing results for
Did you mean:

## BNO080 - problem to obtain yaw, pitch and roll Established Member

## BNO080 - problem to obtain yaw, pitch and roll

Hi,

I have a problem with the BNO80 sensor to obtain yaw, pitch and roll.

With this buffer 'cargo':
0x17 0x80 0x03 0xAF 0xFB 0x19 0x00 0x00 0x00 0x05 0x0B 0x00 0x00 0xC6 0xFE 0xB0 0x01 0x29 0x3A 0xA2 0x1A 0x44 0x32

I have obtain this results:

I processing the cargo buffer to obtain the quaternions :
q1 = ( ( ( int16_t ) cargo [ 14 ] << 8 ) | cargo [ 13 ] ) ;
q2 = ( ( ( int16_t ) cargo [ 16 ] << 8 ) | cargo [ 15 ] ) ;
q3 = ( ( ( int16_t ) cargo [ 18 ] << 8 ) | cargo [ 17 ] ) ;
q0 = ( ( ( int16_t ) cargo [ 20 ] << 8 ) | cargo [ 19 ] ) ;

#define QP14 0.0000610352f

q0 *= QP14 ;
q1 *= QP14 ;
q2 *= QP14 ;
q3 *= QP14 ;

Results:
q1 = 3.9808
q2 = 0.0263
q3 = 0.9087
q0 = 0.4161

To obtain yaw, pitch and roll i have applied this conversions :
tmp_yaw = atan2 ( ( q1 * q2 + q0 * q3 ) , ( ( q0 * q0 + q1 * q1 ) - 0.5f ) ) ;
tmp_pitch = -asin ( 2.0f * ( q1 * q3 - q0 * q2 ) ) ;
tmp_roll = atan2 ( ( q0 * q1 + q2 * q3 ) , ( ( q0 * q0 + q3 * q3 ) - 0.5f ) ) ;

Results:
tmp_yaw = 0.0311
tmp_pitch = 0
tmp_roll = 1.2821

I have convert this variables in degrees:
pitch = tmp_pitch * ( 180.0 / M_PI ) ;
yaw = tmp_yaw * ( 180.0 / M_PI ) ;
roll = tmp_roll * ( 180.0 / M_PI ) ;

Results:
pitch = 0
yaw = 1.78
roll = 73.46

These results are in degrees, it are not real because the BNO080 sensor is stopped. Where is the problem ? It's urgent !

Thanks you!

Regards,

Tags (3)  