mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
Show the average rotation rates, too.
This commit is contained in:
parent
d913f8dec0
commit
e77aee3967
3 changed files with 9 additions and 3 deletions
|
@ -236,6 +236,11 @@ void SerialInterface::readData(float deltaTime) {
|
|||
glm::vec3 angularAcceleration = (deltaTime < EPSILON) ? glm::vec3() : (rotationRates - _lastRotationRates) / deltaTime;
|
||||
_lastRotationRates = rotationRates;
|
||||
|
||||
_averageRotationRates = (1.f - 1.f/(float)LONG_TERM_RATE_SAMPLES) * _averageRotationRates +
|
||||
1.f/(float)LONG_TERM_RATE_SAMPLES * _lastRotationRates;
|
||||
|
||||
printLog("r: %g %g %g\n", _averageRotationRates.x, _averageRotationRates.y, _averageRotationRates.z);
|
||||
|
||||
// Update raw rotation estimates
|
||||
glm::quat estimatedRotation = glm::quat(glm::radians(_estimatedRotation)) *
|
||||
glm::quat(glm::radians(deltaTime * _lastRotationRates));
|
||||
|
@ -247,7 +252,7 @@ void SerialInterface::readData(float deltaTime) {
|
|||
_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);
|
||||
printLog("a: %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 &&
|
||||
|
|
|
@ -74,6 +74,7 @@ private:
|
|||
glm::vec3 _lastRotationRates;
|
||||
|
||||
glm::vec3 _averageAcceleration;
|
||||
glm::vec3 _averageRotationRates;
|
||||
|
||||
glm::mat3 _angularVelocityToLinearAccel;
|
||||
glm::mat3 _angularAccelToLinearAccel;
|
||||
|
|
|
@ -102,12 +102,12 @@ void setAtBit(unsigned char& byte, int bitIndex) {
|
|||
}
|
||||
|
||||
int getSemiNibbleAt(unsigned char& byte, int bitIndex) {
|
||||
return (byte >> (7 - bitIndex) & 3); // semi-nibbles store 00, 01, 10, or 11
|
||||
return (byte >> (6 - bitIndex) & 3); // semi-nibbles store 00, 01, 10, or 11
|
||||
}
|
||||
|
||||
void setSemiNibbleAt(unsigned char& byte, int bitIndex, int value) {
|
||||
//assert(value <= 3 && value >= 0);
|
||||
byte += ((value & 3) << (7 - bitIndex)); // semi-nibbles store 00, 01, 10, or 11
|
||||
byte += ((value & 3) << (6 - bitIndex)); // semi-nibbles store 00, 01, 10, or 11
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue