07-08-2020 07:05 PM - edited 07-09-2020 01:59 PM
Dear community,
I am currently integrating the Bosch BSXlite library into my IMU project, working with the BMI088 and the BMX160.
Since the sensors accelerometer range can be chosen to be 3, 6, 12 or 24g (BMI088) and 2, 4, 8 or 16g (BMX160), resulting in different g per LSB- measurements, I wonder how to set up the range using the BSXlite library (which itself requires the input to be in LSB) to fetch valid output.
I could not find any instructions regarding this in the integration/api documentation.
I did find the bsx_set_accrange(BSX_U8) function in the library's header files, which is only defined for BSX_ACCRANGE_2G, 4G, 8G and 16G, hinting to only be compatible with the BMX160 (though bmi088 links to the bsx library as well).
Am I supposed and if so how, to set up the range of the used sensors within my BSXlite code? (I am aware that with BSXlite, I probably won't have to set the gyroscope's and the magnetometer's range since they are fixed to be 500dps and 16uT/LSB).
Appreciate any help.
Best regards,
George
Solved! Go to Solution.
07-09-2020 02:21 AM
BSX_dostep takes sensor input as physical unit:
accel -> g
gyro -> degree per second
mag -> uT
So you can select what ever you want in sensor side, then convert it to physical unit before call BSX thread
07-09-2020 12:16 PM - edited 07-09-2020 01:58 PM
Hi Vincent,
thanks a lot for your reply!
According to the "BSXlite_API_Documentation" and "BSXlite_LibraryIntegrationGuideline" -pdf this does not seem to be correct. See below:
They all state the library's input has to be in LSB format. Is this a documentation error? If so, does 'bsx_dopreprocess' require input in the units suggested by you as well? Thanks a lot.
-------------------------------------
-------------------------------------
-------------------------------------
07-13-2020 07:41 AM
The LSB format in the document can be used for some sensors' (such as bmi160) default configuration. For example,
ACC: if we set range = +/- 2g, the input acc data unit =1 LSB = 2g/2^15 = g/16384 = 0.061 mg. (resolution = 0.061mg/LSB)
GYRO: if we set range = +/-500 dps, the input gyro data unit =1 LSB = 500dps/2^15 = 0.0153 dps
It is recommended to directly use the physical units as the input of Bsxlite. Based on the verfication results, we can get the following input uints:
ACC: 0.061 mg
GYRO: 0.0153 dps
MAG: 0.1 uT
07-15-2020 04:25 PM - edited 07-16-2020 02:25 AM
Hi xuchang and thanks for replying.
I still don't quite understand how this should work.
I fetch the sensor data with the BMI160 API using 'bmi160_get_sensor_data'. This function returns a bmi160_sensor_data structs, which contains the members int16_t x, int16_t y, int16_t z, and uint32_t sensortime. The x-value for the accelerometer can be converted to a value in g by knowing the set range and thereby the resolution.