History

Compass tweaks: better initial extents, scale extents to compensate for anisotropy, converge more quickly on compass heading.

Andrzej Kapolka committed 13 years ago

Commit 4e524d71 parent 3ec81b12 files · +4 −4Browse files

Showing the changes to interface/src/SerialInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/SerialInterface.cpp+2−2
@@ -31,7 +31,7 @@ const short NO_READ_MAXIMUM_MSECS = 3000; · 30 unmodified lines
3131 const int GRAVITY_SAMPLES = 60; // Use the first few samples to baseline values
3232 const int NORTH_SAMPLES = 30;
3333 const int ACCELERATION_SENSOR_FUSION_SAMPLES = 20;
34−const int COMPASS_SENSOR_FUSION_SAMPLES = 200;
34+const int COMPASS_SENSOR_FUSION_SAMPLES = 100;
3535 const int LONG_TERM_RATE_SAMPLES = 1000;
3636
3737 const bool USING_INVENSENSE_MPU9150 = 1;
@@ -383,7 +383,7 @@ void SerialInterface::resetSerial() { · 345 unmodified lines
383383 glm::vec3 SerialInterface::recenterCompass(const glm::vec3& compass) {
384384 // compensate for "hard iron" distortion by subtracting the midpoint on each axis; see
385385 // http://www.sensorsmag.com/sensors/motion-velocity-displacement/compensating-tilt-hard-iron-and-soft-iron-effects-6475
386− return compass - (_compassMinima + _compassMaxima) * 0.5f;
386+ return (compass - (_compassMinima + _compassMaxima) * 0.5f) / (_compassMaxima - _compassMinima);
387387 }
388388
389389