History

Add back yaw decay the quaternion way.

Andrzej Kapolka committed 13 years ago

Commit 081f1931 parent d87e1651 file · +6 −0Browse files

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

Unified · Split

interface/src/SerialInterface.cpp+6−0
@@ -262,6 +262,12 @@ void SerialInterface::readData(float deltaTime) { · 261 unmodified lines
262 estimatedRotation = safeMix(estimatedRotation,262 estimatedRotation = safeMix(estimatedRotation,
263 rotationBetween(estimatedRotation * _lastAcceleration, _gravity) * estimatedRotation,263 rotationBetween(estimatedRotation * _lastAcceleration, _gravity) * estimatedRotation,
264 1.0f / SENSOR_FUSION_SAMPLES);264 1.0f / SENSOR_FUSION_SAMPLES);
265
266 // Without a compass heading, always decay estimated Yaw slightly
267 const float YAW_DECAY = 0.995;
268 glm::vec3 forward = estimatedRotation * glm::vec3(0.0f, 0.0f, -1.0f);
269 safeMix(glm::angleAxis(glm::degrees(atan2f(forward.x, -forward.z)), glm::vec3(0.0f, 1.0f, 0.0f)) *
270 estimatedRotation, estimatedRotation, YAW_DECAY);
265 }271 }
266 }272 }
267 273

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t