Initial values, report error.

This commit is contained in:
Andrzej Kapolka 2013-06-11 13:02:20 -07:00
parent ff9e6f831c
commit 517bbe80a7
2 changed files with 10 additions and 2 deletions

View file

@ -249,6 +249,8 @@ void SerialInterface::readData(float deltaTime) {
_angularAccelToLinearAccel * angularAcceleration;
glm::vec3 error = _estimatedAcceleration - predictedAcceleration;
printLog("error %g\n", glm::length(error));
// adjust according to error in each dimension, in proportion to input magnitudes
for (int i = 0; i < 3; i++) {
if (fabsf(error[i]) < EPSILON) {

View file

@ -31,8 +31,14 @@ public:
_estimatedVelocity(0, 0, 0),
_lastAcceleration(0, 0, 0),
_lastRotationRates(0, 0, 0),
_angularVelocityToLinearAccel(0),
_angularAccelToLinearAccel(0)
_angularVelocityToLinearAccel( // experimentally derived initial values
0.001f, -0.008f, 0.020f,
0.003f, -0.003f, 0.025f,
0.017f, 0.007f, 0.029f),
_angularAccelToLinearAccel( // experimentally derived initial values
0.0f, 0.0f, 0.002f,
0.0f, 0.0f, 0.002f,
-0.002f, -0.002f, 0.0f)
{}
void pair();