History

SixenseManager: fix velocity and angularVelocity computation

Copied the delta based computation of velocity and angularVelocity that was in Application::setPalmData() and moved it into SixenseManager. This will guarantee that the velocity computation is the same as it was previously. The goal here is to NOT change the behavior of the hydra. The moving average style calculation of velocities has been removed. Removed dead code.

Anthony J. Thibault committed 10 years ago

Commit 0fd26001 parent 3b87cd05 files · +16 −103Browse files

Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all

Unified · Split

interface/src/Application.cpp+0−25
@@ -5036,31 +5036,6 @@ void Application::setPalmData(Hand* hand, const controller::Pose& pose, float de · 5035 unmodified lines
5036 // controller pose is in Avatar frame.5036 // controller pose is in Avatar frame.
5037 glm::vec3 position = pose.getTranslation();5037 glm::vec3 position = pose.getTranslation();
5038 glm::quat rotation = pose.getRotation();5038 glm::quat rotation = pose.getRotation();
5039
5040 // AJT: REMOVE
5041 /*
5042 // Compute current velocity from position change
5043 glm::vec3 rawVelocity;
5044 if (deltaTime > 0.0f) {
5045 rawVelocity = (position - palm.getRawPosition()) / deltaTime;
5046 } else {
5047 rawVelocity = glm::vec3(0.0f);
5048 }
5049 palm.setRawVelocity(rawVelocity); // meters/sec
5050
5051 // Angular Velocity of Palm
5052 glm::quat deltaRotation = rotation * glm::inverse(palm.getRawRotation());
5053 glm::vec3 angularVelocity(0.0f);
5054 float rotationAngle = glm::angle(deltaRotation);
5055 if ((rotationAngle > EPSILON) && (deltaTime > 0.0f)) {
5056 angularVelocity = glm::normalize(glm::axis(deltaRotation));
5057 angularVelocity *= (rotationAngle / deltaTime);
5058 palm.setRawAngularVelocity(angularVelocity);
5059 } else {
5060 palm.setRawAngularVelocity(glm::vec3(0.0f));
5061 }
5062 */
5063
5064 glm::vec3 rawVelocity = pose.getVelocity();5039 glm::vec3 rawVelocity = pose.getVelocity();
5065 glm::vec3 angularVelocity = pose.getAngularVelocity();5040 glm::vec3 angularVelocity = pose.getAngularVelocity();
5066 5041