Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Axis remapping of IMU (BNO055) for Arduino (C++)

    FAE_CA1
    Community Moderator

    Re: Axis remapping of IMU (BNO055) for Arduino (C++)

    Hi,

    After you do,

    bno055_set_operation_mode(OPERATION_MODE_CONFIG);
    0x24; // this value is written to register 0x41
    0x05; // this value is written to register 0x42

    then you can read back register 0x41 and 0x42 to verify if the above two values have been successfully written to the registers or not. If yes, then BNO055 will be at P7 orientation. Its z axis is up side down. At this moment if you read accelerometer data from BNO055 which are data registers from 0x08 to 0x0D, you will find out that when BNO055 z axis is pointing to sky, BNO055 accelerometer z axis data will be -1g or -9.8m/s^2. This means that the axis remapping takes effect, because the default orientation is P1 with values of 0x24, 0x00 for register 0x41 and 0x42 respectively and when z axis is pointing to sky z axis data should be +1g or +9.8m/s^2.

    Thanks.

    xeonus
    Member

    Re: Axis remapping of IMU (BNO055) for Arduino (C++)

    Thanks again for your help!

    Oh okay so it actually works that way.

    I tried to read back the registers by:
    Serial.println(0x41);
    Serial.println(0x42);

    for (0x41): it says: 65
    for (0x42): 66. 

    not sure if I did something wrong, or I can't interpret it. 

    But by checking the z axis, i know the axis manipulation did not work. And additionally I am also bit confused why the gravitational force (1g) is positive, when the z axis is by default looking into the sky, but gravity get is stuck to the earth and not to the sky. I hope it is understandable what i mean. In my head 9,8 m/s should be - 9,8 m/s if z is looking upwards.
    A explenation would be for me, if it is already pre manipulated for P1 to have positive numbers..

    Have a good day!

     

    FAE_CA1
    Community Moderator

    Re: Axis remapping of IMU (BNO055) for Arduino (C++)

    Hi,

    By default we use ENU (east-north-up) coordinate system for MEMS sensors. So when z axis is pointing to sky we define +1g for the accelerometer. If you use NED (north-east-down) coordinate system like aircraft, then z axis is +1g when it is pointing to ground. You can do your own axes remapping on any MEMS sensor. But BNO055 provides you with this feature built-in.

    Thanks.

    spiderolsen
    New Poster

    Re: Axis remapping of IMU (BNO055) for Arduino (C++)

    Hi xeonus,

    I just registered to this forum to help you out, haha 😋
    Considering that you´re surprised that the result of Serial.println(0x41); is 65, shows me that you´re a newbie as I am 😄

    0x41 is a hexadecimal number value, which converted to a decimal value is 65. For better understanding: Click here for hexadecimal table 
    Serial.printIn is also no command to read any registers from BNO0555 sensor. In easy words this command says "Send the thing, which is in the brackets, via serial port to your serial monitor console." So by writing Serial.println(0x41);, you´re basically saying Serial.println(65);, which means: "Display the value 65 in the serial monitor"

     

    Spoiler
    There is btw also a difference between Serial.print and Serial.println, so google it, if you want to know the difference 😛

     

    I assume that you´re using some type of Arduino board and a BNO055 Breakout Board? 
    If yes, then just download and copy this library to your Arduino-libraries-folder:
    https://github.com/arduino-libraries/BNO055 

    Then open up in Arduino IDE the "Basic.ino" example and replace the void setup with this:

    void setup() //This code is executed once
    {
    //Initialize I2C communication
    Wire.begin();

    //Initialization of the BNO055
    BNO_Init(&myBNO); //Assigning the structure to hold information about the device

    //Configuration to Config mode
    bno055_set_operation_mode(OPERATION_MODE_CONFIG);

    delay(1);
    bno055_set_axis_remap_value(REMAP_X_Y);
    delay(1);
    bno055_set_x_remap_sign(0x01);
    delay(1);
    bno055_set_y_remap_sign(0x01);
    delay(1);
    bno055_set_z_remap_sign(0x01);
    }

    In the file BNO055.h in line 521 you can see that REMAP_X_Y stands for 0X21.
    In the file BNO055.c you can look up how the talented boys and girls from Bosch wrote the functions bno055_set_operation_mode, bno055_set_axis_remap_value, bno055_set_x_remap_sign, ... .

    I´m not 100% sure, if my suggested commands for the remap_sign are correct, but reading the BNO055.c, I think it could work. 😄

    I guess the moderator didn´t answered all of your questions, because you´re asking for really basic stuff ^^
    Hopefully I could help you in some way and it´ll work... 😛

    Best regards

    ppecch
    New Poster

    Re: Axis remapping of IMU (BNO055) for Arduino (C++)

    Hi 

    I'm trying to do the same thing with my very limited programming experience.   I want to reorient the BNO055 in the vertical position for an application I'm working on.  Can anyone comment on this below and make a suggestions,  please and thank you.  Im trying to swap the Z axis for the Y axis

     

    void setup() {

    Wire.begin();

    BNO_Init(&myBNO); 


    bno055_set_operation_mode(OPERATION_MODE_CONFIG);

    delay(1);
    bno055_set_axis_remap_value(REMAP_Y_Z);
    delay(1);
    bno055_set_x_remap_sign(0x01);
    delay(1);
    bno055_set_y_remap_sign(0x01);
    delay(1);
    bno055_set_z_remap_sign(0x01);
    }

    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