Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HMC58X3 MODI2C MPU6050 MS561101BA
Fork of FreeIMU by
Revision 9:a79af1283446, committed 2014-01-10
- Comitter:
- tyftyftyf
- Date:
- Fri Jan 10 05:41:40 2014 +0000
- Parent:
- 8:cd43764b9623
- Child:
- 10:4e8ac6acd336
- Commit message:
- Tuning parameters
Changed in this revision
--- a/FreeIMU.cpp Mon Dec 23 09:41:27 2013 +0000
+++ b/FreeIMU.cpp Fri Jan 10 05:41:40 2014 +0000
@@ -45,8 +45,8 @@
twoKp = twoKpDef;
twoKi = twoKiDef;
- twoKiz = twoKiDef / 6.0;
- twoKpz = twoKpDef * 8.0;
+ twoKiz = twoKiDef / 4.0;
+ twoKpz = twoKpDef * 6.0;
integralFBx = 0.0f, integralFBy = 0.0f, integralFBz = 0.0f;
@@ -246,7 +246,7 @@
*/
void FreeIMU::zeroGyro()
{
- const int totSamples = 8;
+ const int totSamples = 64;
int16_t raw[11];
float tmpOffsets[] = {0,0,0};
@@ -255,7 +255,7 @@
tmpOffsets[0] += raw[3];
tmpOffsets[1] += raw[4];
tmpOffsets[2] += raw[5];
- Thread::wait(2);
+ Thread::wait(3);
}
gyro_off_x = tmpOffsets[0] / totSamples;
@@ -263,7 +263,7 @@
gyro_off_z = tmpOffsets[2] / totSamples;
}
-extern bool magn_valid;
+extern volatile bool magn_valid;
/**
* Quaternion implementation of the 'DCM filter' [Mayhony et al]. Incorporates the magnetic distortion
--- a/FreeIMU.h Mon Dec 23 09:41:27 2013 +0000 +++ b/FreeIMU.h Fri Jan 10 05:41:40 2014 +0000 @@ -106,8 +106,8 @@ // HMC5843 address is fixed so don't bother to define it -#define twoKpDef (2.0f * 1.0f) // 2 * proportional gain -#define twoKiDef (2.0f * 0.6f) // 2 * integral gain +#define twoKpDef (2.0f * 3.0f) // 2 * proportional gain +#define twoKiDef (2.0f * 0.4f) // 2 * integral gain #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
--- a/HMC58X3.lib Mon Dec 23 09:41:27 2013 +0000 +++ b/HMC58X3.lib Fri Jan 10 05:41:40 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/tyftyftyf/code/HMC58X3/#8eb12adc8368 +http://mbed.org/users/tyftyftyf/code/HMC58X3/#ea869bfe993b
--- a/calibration.h Mon Dec 23 09:41:27 2013 +0000 +++ b/calibration.h Fri Jan 10 05:41:40 2014 +0000 @@ -7,16 +7,16 @@ #define CALIBRATION_H -const int acc_off_x = 291; -const int acc_off_y = -236; -const int acc_off_z = -2330; -const float acc_scale_x = 15073.187570; -const float acc_scale_y = 16496.811960; -const float acc_scale_z = 16887.470139; +const int acc_off_x = 72; +const int acc_off_y = -8; +const int acc_off_z = 211; +const float acc_scale_x = 15827.435944; +const float acc_scale_y = 16533.974047; +const float acc_scale_z = 16841.679423; -const int magn_off_x = 41; -const int magn_off_y = -67; -const int magn_off_z = -150; -const float magn_scale_x = 486.457717; -const float magn_scale_y = 503.317575; -const float magn_scale_z = 410.482174; +const int magn_off_x = 56; +const int magn_off_y = -73; +const int magn_off_z = -145; +const float magn_scale_x = 753.324584; +const float magn_scale_y = 742.324931; +const float magn_scale_z = 632.931308;
