Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

the IMU library to rule them all (wip)

License

NotificationsYou must be signed in to change notification settings

LiquidCGS/FastIMU

Repository files navigation

1

Supported IMUS:

  • MPU9255
  • MPU9250
  • MPU6886
  • MPU6515
  • MPU6500
  • MPU6050
  • ICM20689
  • ICM20690
  • BMI055
  • BMX055 (Magnetometer currently untested)
  • BMI160
  • LSM6DS3 (And some of it's variants)
  • LSM6DSL (currently untested)
  • QMI8658

Supported Magnetometers:

  • QMC5883L
  • HMC5883L
  • AK8975
  • AK8963
  • AK09918

Using non default I2C ports:

If you're planning on using an IMU on a non-default I2C port, you can specify the port in the constructor of your IMU, for example:

ICM20689IMU1(Wire); MPU6500IMU2(Wire1);

creates two IMU objects,ICM20689 will be using the I2C port assigned toWire andMPU6500 will be on the I2C port assigned toWire1.

Hybrid IMU's:

You can also use Hybrid IMU's, which means you can add any supported magnetometer to any supported IMU by using theIMU_HYBRID class as follows:

IMU_HYBRID<IMU, MAG>IMU(Wire);

For example

IMU_HYBRID<MPU6050, QMC5883L>IMU(Wire);

creates a hybridMPU6050 andQMC5883L IMU object that behaves as a single IMU, that returns accel and gyro values from theMPU6050 and magnetometer values from theQMC5883L respectively

Planned:

  • BNO080 (probably soonish)
  • GY-85
  • BMM150
  • BNO055 (the one I bought is DOA... might take a bit)
  • ICM20948
  • BMI270 (if I can get my hands on one)

Data types

  • AccelData Contains all three axis of Accelerometer data, these are namedaccelX,accelY andaccelZ

  • GyroData Contains all three axis of Gyroscope data, these are namedgyroX,gyroY andgyroZ

  • MagData Contains all three axis of Magnetometer data, these are namedmagX,magY andmagZ

  • Quaternion Contains Quaternion data, the components are namedqW,qX,qY andqZ

  • CalData Contains a boolean component namedvalid that must be set totrue if the data is valid, it contains float array namedaccelBias for accelerometer biases, one namedgyroBias for gyroscope bias, one namedmagBias for magnetometer biases and one namedmagScale for magnetometer scaling.

Functions

  • init Takes in acalData function and an optionalbyte address, this function initializes the IMU, it defaults to the maximum ranges allowed by the IMU. This function will return a 0 if initialization was successful and a negative number if it failed to connect to the IMU. if no address is provided, the default for the selected IMU will be used.

  • update Reads new IMU data if available.

  • getAccel Takes in a pointer toAccelData and copies new accelerometer data to it, should be called after update.

  • getGyro Takes in a pointer toGyroData and copies new gyroscope data to it, should be called after update.

  • getMag Takes in a pointer toMagData and copies new magnetometer data to it, should be called after update. Will only return new magnetometer data if the IMU has a magnetometer.

  • getQuat Takes in a pointer to aQuaternion and copies new quaternion data to it, should be called after update. Will only return new Quaternion data if the IMU has a Quaternion output.

  • getTemp Returns temperature float data in °C, should be called after update, isn't very accurate.

  • setGyroRange Takes in an integer with the dps range wanted, (for example 2000 for ±2000dps), returns 0 if successful, returns -1 if the input range is not valid.

  • setAccelRange Takes in an integer with the dps range wanted, (for example 8 for ±8g), returns 0 if successful, returns -1 if the input range is not valid.

  • setIMUGeometry Takes in an integer with the wanted geometry index, rotates IMU measurements to match vr headset IMU mount. (see chart below).

  • calibrateAccelGyro Takes in a pointer to calibration data and runs a Accelerometer and Gyroscope calibration, storing the new accelerometer and gyroscope calibration data in it. the IMU should be kept completely still and level during this.

  • calibrateMag Takes in a pointer to Calibration data and runs a Accelerometer and Gyroscope calibration, storing the new accelerometer and gyroscope calibration data in it. the IMU should be moved in a figure eight pattern while calibrating, calibration takes around 15 seconds.

  • hasMagnetometer Returns true if the IMU has a magnetometer.

  • hasTemperature Returns true if the IMU has a thermometer.

  • hasQuatOutput Returns true if the IMU has a direct quaternion output.

  • IMUName Returns a string containing the IMU's name.

  • IMUType Returns a string containing the IMU's type.

  • IMUManufacturer Returns a string containing the IMU's manufacturer.

Supported IMU VR geometries (and their index numbers):

2

TODO: get DMP working for pure quaternion output from invsense IMU's
TODO: get FIFO working for all IMU's that have it.
TODO: get timestamping working
TODO: get proper matrix magnetometer calibration working instead of the current scalar garbage.

[8]ページ先頭

©2009-2025 Movatter.jp