arduino / ArduinoCore-arc32

GNU Lesser General Public License v2.1
329 stars 284 forks source link

Placing the breadboard with BMI160 to horizontally(remapping axis) #606

Closed brightproject closed 1 year ago

brightproject commented 1 year ago

I use such a board in the device BMI160

Based on examle code

only placing it not horizontally, but vertically. Скриншот 10-08-2023 19 36 00

How to remap the axes, I did not find another way how to do remapping through Bosch software.

I pass the data through the Madgwick filter and get the roll, pitch and heading angles at the output. But if I use this data when the board is in a vertical position, I have very small movements, due to the lack of axes. But if I use the received data for processing and visualize them using the transformation matrix, then all rotations of the body are normally performed. Скриншот 10-08-2023 22 58 59

As far as I understand, there are two ways to solve the problem with the orientation of the axes:

  1. changing raw data directly in the Bosch sensor
  2. application of the transformation matrix, but this requires the computing power of the microcontroller Unfortunately, I did not find working examples with axis orientation for BMI160. I try apply calibration offsets also

    BMI160.autoCalibrateGyroOffset();
    
    BMI160.autoCalibrateAccelerometerOffset(X_AXIS, 0);
    BMI160.autoCalibrateAccelerometerOffset(Y_AXIS, 0);
    BMI160.autoCalibrateAccelerometerOffset(Z_AXIS, 1);

    While I do not understand the functions autoCalibrateAccelerometerOffset and autoCalibrateGyroOffset well enough, it seems to me that it should set the value of accelerometers and accelerations to zero when the board is placed in the desired position (on its side, upside down, at an angle) and start counting from a calibrated "point". Or am I misinterpreting the autoCalibrateAccelerometerOffset and autoCalibrateGyroOffset functionality?

brightproject commented 1 year ago

imageAxis

[Solution](https://github.com/peterashwoodsmith/ArtificialHorizon/issues/1#issuecomment-1676422471