Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Axis Remapping for the BNO055 #10

Open
budryerson opened this issue Jul 7, 2016 · 0 comments
Open

Axis Remapping for the BNO055 #10

budryerson opened this issue Jul 7, 2016 · 0 comments

Comments

@budryerson
Copy link

Your library folder is called NAxesMotion but the files themselves are named NAxisMotion. It is mildly confusing that the three are not spelled the same way (AxEs vs AxIs). Further, the library.properties file begins with the line name=9 Axes Motion, which just adds to the confusion. For my install, I have renamed everything NAxisMotion.

My real issue is the lack of Axis Remap functionality. My IMU is mounted transversely on my platform, which is not unusual, so I need to remap the BNO055 device to what the User Guide calls the P0 position (P1 is the default).

For my purposes, I added the following code to your NAxisMotion library. Others may wish to do something similar, or you may want to include a re-positioning option in the next version.


************************************************************
* Remap Axes and Signs to BNO055 User Guide position P0
* This swaps X/Y axes and sets the X axis negative by
* calling the "utility" BNO055 library functions directly.
*
*     value     |   definition      | comments
*   ------------|-------------------|------------
*      0X21     | REMAP_X_Y         | Z=Z;X=Y;Y=X
*      0X18     | REMAP_Y_Z         | X=X;Y=Z;Z=Y
*      0X06     | REMAP_Z_X         | Y=Y;X=Z;Z=X
*      0X12     | REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y
*      0X09     | REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X
*      0X24     | DEFAULT_AXIS      | X=X;Y=Y;Z=Z
*
/*************************************************************/
void NAxisMotion::remapAxisPosition()
{
    // Each operation takes an 'unsigned char' (byte) as its input
    // The definitions are from the BNO055 library
    bno055_set_axis_remap_value( REMAP_X_Y);              // 0x21 = REMAP_X_Y
    bno055_set_remap_x_sign( REMAP_AXIS_NEGATIVE);        // 0x01 = REMAP_AXIS_NEGATIVE
    bno055_set_remap_y_sign( REMAP_AXIS_POSITIVE);        // 0x00 = REMAP_AXIS_POSITIVE
    delay(30);
}

The individual functions are called from the included BNO055 library directly. Because remapping cannot occur unless the device is in the CONFIG Operation Mode mode, it helps to understand that each BNO055 function reads, saves and then restores the current Operation Mode.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant