mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
Actually, we want it sans gravity.
This commit is contained in:
parent
4b890e2ccc
commit
d913f8dec0
1 changed files with 5 additions and 4 deletions
|
@ -218,10 +218,6 @@ void SerialInterface::readData(float deltaTime) {
|
|||
|
||||
_lastAcceleration = glm::vec3(-accelXRate, -accelYRate, -accelZRate) * LSB_TO_METERS_PER_SECOND2;
|
||||
|
||||
_averageAcceleration = (1.f - 1.f/(float)LONG_TERM_RATE_SAMPLES) * _averageAcceleration +
|
||||
1.f/(float)LONG_TERM_RATE_SAMPLES * _lastAcceleration;
|
||||
|
||||
printLog("%g %g %g\n", _averageAcceleration.x, _averageAcceleration.y, _averageAcceleration.z);
|
||||
|
||||
int rollRate, yawRate, pitchRate;
|
||||
|
||||
|
@ -248,6 +244,11 @@ void SerialInterface::readData(float deltaTime) {
|
|||
_estimatedAcceleration = (totalSamples < GRAVITY_SAMPLES) ? glm::vec3() :
|
||||
_lastAcceleration - glm::inverse(estimatedRotation) * _gravity;
|
||||
|
||||
_averageAcceleration = (1.f - 1.f/(float)LONG_TERM_RATE_SAMPLES) * _averageAcceleration +
|
||||
1.f/(float)LONG_TERM_RATE_SAMPLES * _estimatedAcceleration;
|
||||
|
||||
printLog("%g %g %g\n", _averageAcceleration.x, _averageAcceleration.y, _averageAcceleration.z);
|
||||
|
||||
// Consider updating our angular velocity/acceleration to linear acceleration mapping
|
||||
if (glm::length(_estimatedAcceleration) > EPSILON &&
|
||||
(glm::length(_lastRotationRates) > EPSILON || glm::length(angularAcceleration) > EPSILON)) {
|
||||
|
|
Loading…
Reference in a new issue