From b660336b2a728f6ecb7f3286715c6ae6c0f0b482 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 2 Jul 2013 16:59:03 -0700 Subject: [PATCH 1/3] Fix for camera movement with webcam enabled; don't bother using roll from webcam if we have the gyros; reinstate head orientation scaling; don't bother using gyro position. --- interface/src/Application.cpp | 2 +- interface/src/Avatar.cpp | 10 ++++++---- interface/src/SerialInterface.cpp | 6 ------ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 70f7287aab..efd733937c 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -363,7 +363,7 @@ void Application::paintGL() { glEnable(GL_LINE_SMOOTH); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - float headCameraScale = _serialHeadSensor.isActive() ? _headCameraPitchYawScale : 1.0f; + float headCameraScale = (_serialHeadSensor.isActive() || _webcam.isActive()) ? _headCameraPitchYawScale : 1.0f; if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { _myCamera.setTightness (100.0f); diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 277cca906e..97e0f71c5a 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -286,15 +286,17 @@ void Avatar::reset() { // Update avatar head rotation with sensor data void Avatar::updateHeadFromGyrosAndOrWebcam() { - const float AMPLIFY_PITCH = 1.f; - const float AMPLIFY_YAW = 1.f; - const float AMPLIFY_ROLL = 1.f; + const float AMPLIFY_PITCH = 2.f; + const float AMPLIFY_YAW = 2.f; + const float AMPLIFY_ROLL = 2.f; SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); glm::vec3 estimatedPosition, estimatedRotation; if (gyros->isActive()) { - estimatedPosition = gyros->getEstimatedPosition(); + if (webcam->isActive()) { + estimatedPosition = webcam->getEstimatedPosition(); + } estimatedRotation = gyros->getEstimatedRotation(); } else if (webcam->isActive()) { diff --git a/interface/src/SerialInterface.cpp b/interface/src/SerialInterface.cpp index 63e5bd61c6..7158cb84b6 100644 --- a/interface/src/SerialInterface.cpp +++ b/interface/src/SerialInterface.cpp @@ -341,12 +341,6 @@ void SerialInterface::readData(float deltaTime) { _estimatedRotation = safeEulerAngles(estimatedRotation); - // Fuse gyro roll with webcam roll - if (webcam->isActive()) { - _estimatedRotation.z = glm::mix(_estimatedRotation.z, webcam->getEstimatedRotation().z, - 1.0f / SENSOR_FUSION_SAMPLES); - } - totalSamples++; } From a1d0f255cc1c7367590c2ccbca2644a518d8f189 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 2 Jul 2013 17:03:37 -0700 Subject: [PATCH 2/3] Not crazy about the rotation amplification. --- interface/src/Avatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 97e0f71c5a..80e1fd411f 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -286,9 +286,9 @@ void Avatar::reset() { // Update avatar head rotation with sensor data void Avatar::updateHeadFromGyrosAndOrWebcam() { - const float AMPLIFY_PITCH = 2.f; - const float AMPLIFY_YAW = 2.f; - const float AMPLIFY_ROLL = 2.f; + const float AMPLIFY_PITCH = 1.f; + const float AMPLIFY_YAW = 1.f; + const float AMPLIFY_ROLL = 1.f; SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); From 4ecb4ab3c6f276018ae7bf84a4eeecb5cbc0307e Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 2 Jul 2013 17:14:54 -0700 Subject: [PATCH 3/3] Restore the amplification; blink faster. --- interface/src/Avatar.cpp | 6 +++--- interface/src/Head.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 80e1fd411f..97e0f71c5a 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -286,9 +286,9 @@ void Avatar::reset() { // Update avatar head rotation with sensor data void Avatar::updateHeadFromGyrosAndOrWebcam() { - const float AMPLIFY_PITCH = 1.f; - const float AMPLIFY_YAW = 1.f; - const float AMPLIFY_ROLL = 1.f; + const float AMPLIFY_PITCH = 2.f; + const float AMPLIFY_YAW = 2.f; + const float AMPLIFY_ROLL = 2.f; SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 48a0caab5e..44eddeeb93 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -179,7 +179,7 @@ void Head::simulate(float deltaTime, bool isMine) { _browAudioLift *= 0.7f; // update eyelid blinking - const float BLINK_SPEED = 5.0f; + const float BLINK_SPEED = 10.0f; const float FULLY_OPEN = 0.0f; const float FULLY_CLOSED = 1.0f; if (_leftEyeBlinkVelocity == 0.0f && _rightEyeBlinkVelocity == 0.0f) {