-
大小: 50KB文件類型: .rar金幣: 2下載: 0 次發布日期: 2021-06-07
- 語言: 其他
- 標簽: arduino??MPU6050??offset??calibration??
資源簡介
arduino程序,自動計算MPU6050的offset,顯示如下:
Sensor readings with offsets: 0 0 16391 -2 0 0
Your offsets: -1495 -454 2369 58 -36 31
Data is printed as: acelX acelY acelZ giroX giroY giroZ
Check that your sensor readings are close to 0 0 16384 0 0 0
If calibration was succesful write down your offsets so you can set them in your projects using something similar to mpu.setXAccelOffset(youroffset)
簡單快速,把該偏移帶入mpu6050替換下面的值:
// supply your own gyro offsets here, scaled for min sensitivity
mpu.setXAccelOffset(-1495);
mpu.setYAccelOffset(-454);
mpu.setZAccelOffset(2369);
mpu.setXGyroOffset(58);
mpu.setYGyroOffset(-36);
mpu.setZGyroOffset(31); // 1688 factory default for my test chip 。

代碼片段和文件信息
//?I2Cdev?library?collection?-?MPU6050?I2C?device?class
//?based?on?InvenSense?MPU-6050?register?map?document?rev.?2.0?5/19/2011?(RM-MPU-6000A-00)
//?8/24/2011?by?Jeff?Rowberg?
//?Updates?should?(hopefully)?always?be?available?at?https://github.com/jrowberg/i2cdevlib
//
//?Changelog:
//?????...?-?ongoing?debug?release
//?NOTE:?THIS?IS?ONLY?A?PARIAL?RELEASE.?THIS?DEVICE?CLASS?IS?CURRENTLY?UNDERGOING?ACTIVE
//?DEVELOPMENT?AND?IS?STILL?MISSING?SOME?IMPORTANT?FEATURES.?PLEASE?KEEP?THIS?IN?MIND?IF
//?YOU?DECIDE?TO?USE?THIS?PARTICULAR?CODE?FOR?ANYTHING.
/*?============================================
I2Cdev?device?library?code?is?placed?under?the?MIT?license
Copyright?(c)?2012?Jeff?Rowberg
Permission?is?hereby?granted?free?of?charge?to?any?person?obtaining?a?copy
of?this?software?and?associated?documentation?files?(the?“Software“)?to?deal
in?the?Software?without?restriction?including?without?limitation?the?rights
to?use?copy?modify?merge?publish?distribute?sublicense?and/or?sell
copies?of?the?Software?and?to?permit?persons?to?whom?the?Software?is
furnished?to?do?so?subject?to?the?following?conditions:
The?above?copyright?notice?and?this?permission?notice?shall?be?included?in
all?copies?or?substantial?portions?of?the?Software.
THE?SOFTWARE?IS?PROVIDED?“AS?IS“?WITHOUT?WARRANTY?OF?ANY?KIND?EXPRESS?OR
IMPLIED?INCLUDING?BUT?NOT?LIMITED?TO?THE?WARRANTIES?OF?MERCHANTABILITY
FITNESS?FOR?A?PARTICULAR?PURPOSE?AND?NONINFRINGEMENT.?IN?NO?EVENT?SHALL?THE
AUTHORS?OR?COPYRIGHT?HOLDERS?BE?LIABLE?FOR?ANY?CLAIM?DAMAGES?OR?OTHER
LIABILITY?WHETHER?IN?AN?ACTION?OF?CONTRACT?TORT?OR?OTHERWISE?ARISING?FROM
OUT?OF?OR?IN?CONNECTION?WITH?THE?SOFTWARE?OR?THE?USE?OR?OTHER?DEALINGS?IN
THE?SOFTWARE.
===============================================
*/
#include?“MPU6050.h“
/**?Default?constructor?uses?default?I2C?address.
?*?@see?MPU6050_DEFAULT_ADDRESS
?*/
MPU6050::MPU6050()?{
????devAddr?=?MPU6050_DEFAULT_ADDRESS;
}
/**?Specific?address?constructor.
?*?@param?address?I2C?address
?*?@see?MPU6050_DEFAULT_ADDRESS
?*?@see?MPU6050_ADDRESS_AD0_LOW
?*?@see?MPU6050_ADDRESS_AD0_HIGH
?*/
MPU6050::MPU6050(uint8_t?address)?{
????devAddr?=?address;
}
/**?Power?on?and?prepare?for?general?usage.
?*?This?will?activate?the?device?and?take?it?out?of?sleep?mode?(which?must?be?done
?*?after?start-up).?This?function?also?sets?both?the?accelerometer?and?the?gyroscope
?*?to?their?most?sensitive?settings?namely?+/-?2g?and?+/-?250?degrees/sec?and?sets
?*?the?clock?source?to?use?the?X?Gyro?for?reference?which?is?slightly?better?than
?*?the?default?internal?clock?source.
?*/
void?MPU6050::initialize()?{
????setClockSource(MPU6050_CLOCK_PLL_XGYRO);
????setFullScaleGyroRange(MPU6050_GYRO_FS_250);
????setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
????setSleepEnabled(false);?//?thanks?to?Jack?Elston?for?pointing?this?one?out!
}
/**?Verify?the?I2C?connection.
?*?Make?sure?the?device?is?connected?and?responds?as?expected.
?*?@return?True?if?connection?is?valid?fa
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????6413??2013-10-24?20:52??MPU6050_calibration\helper_3dmath.h
?????文件?????126508??2013-10-24?20:52??MPU6050_calibration\MPU6050.cpp
?????文件??????42528??2013-10-24?20:52??MPU6050_calibration\MPU6050.h
?????文件??????40745??2014-04-06?02:27??MPU6050_calibration\MPU6050_6Axis_MotionApps20.h
?????文件??????48256??2013-10-24?20:52??MPU6050_calibration\MPU6050_9Axis_MotionApps41.h
?????文件???????7820??2018-04-13?10:22??MPU6050_calibration\MPU6050_Calibration.ino
?????目錄??????????0??2018-04-13?13:25??MPU6050_calibration
-----------?---------??----------?-----??----
???????????????272270????????????????????7
評論
共有 條評論