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
31const int GRAVITY_SAMPLES = 60; // Use the first few samples to baseline values31const int GRAVITY_SAMPLES = 60; // Use the first few samples to baseline values
32const int NORTH_SAMPLES = 30;32const int NORTH_SAMPLES = 30;
33const int ACCELERATION_SENSOR_FUSION_SAMPLES = 20;33const int ACCELERATION_SENSOR_FUSION_SAMPLES = 20;
34const int COMPASS_SENSOR_FUSION_SAMPLES = 200;34const int COMPASS_SENSOR_FUSION_SAMPLES = 100;
35const int LONG_TERM_RATE_SAMPLES = 1000; 35const int LONG_TERM_RATE_SAMPLES = 1000;
36 36
37const bool USING_INVENSENSE_MPU9150 = 1;37const bool USING_INVENSENSE_MPU9150 = 1;
@@ -383,7 +383,7 @@ void SerialInterface::resetSerial() { · 345 unmodified lines
383glm::vec3 SerialInterface::recenterCompass(const glm::vec3& compass) {383glm::vec3 SerialInterface::recenterCompass(const glm::vec3& compass) {
384 // compensate for "hard iron" distortion by subtracting the midpoint on each axis; see384 // compensate for "hard iron" distortion by subtracting the midpoint on each axis; see
385 // http://www.sensorsmag.com/sensors/motion-velocity-displacement/compensating-tilt-hard-iron-and-soft-iron-effects-6475385 // 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);
387}387}
388 388
389 389