Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Combining sensor's 3 xyz axis g values into resultant vector

    Combining sensor's 3 xyz axis g values into resultant vector

    Andy__
    Member

    After reading out three individual g values from x, y and z axis of sensor, what is the maths formula to calculate the 'resultant' vector (direction and magnitude)?   How is the maths notation of 'direction' vector?   For aeroplane, traditionally it will be three values, pitch, yaw and roll?  Is there a 'single value' for the vector's direction (or may be something called euler angle)?

    How to calculate the difference between 'TWO VECTORS'?  For example, if the sesnor is placed flat on table, x and y axis is zero.  Z is 9.81 ms-2 (g value).   Call this VECTOR_0 as base reference.   If I rotate the sesnor and the x,y,z resultant is VECTOR_1.   How to calculate the difference between VECTOR_0 (base reference) and VECTOR_1 (new value)?

    Any standard c language library to do the maths?

    Many thanks

    1 REPLY 1

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    3-axis accelerometer is able to measure the tilt angle pitch and roll with respect to earth gravity. The magnitude of 3-axis accelerometer is sqrt(x^2+y^2+z^2). Because accelerometer is not able to measure yaw angle, the direction of the magnitude vector can be pointing to anywhere in 360 degrees like a cone.

    If you want to have yaw angle, then you need to use IMU which is accel + gyro. This will give you 6DoF sensor fusion for absolute pitch/roll angles and relative yaw angle. Relative yaw angle means future rotations are with respect to the initial direction of the magnitude vector. You will not be able to go back to the initial direction after operation because of gyro drift.

    If you want to have absolute yaw, then you need to use IMU + magnetometer to form 9DoF sensor fusion. You can do online search for 9DoF sensor fusion C language libraries. BHI360 + BMM350 can give you absolute heading/pitch/roll Euler angles and the 9DoF sensor fusion algorithm is running inside BHI360. Please see the attached document for evaluation.

    Thanks.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist