mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 16:06:30 +02:00
Merge branch 'calibration-ui-update' into vive-in-desktop
This commit is contained in:
commit
309a03230c
4 changed files with 91 additions and 34 deletions
|
@ -25,11 +25,12 @@ Rectangle {
|
|||
signal canceled()
|
||||
signal restart()
|
||||
|
||||
property int count: 3
|
||||
property int count: 5
|
||||
property string calibratingText: "CALIBRATING..."
|
||||
property string calibratingCountText: "CALIBRATION STARTING IN"
|
||||
property string calibrationSuccess: "CALIBRATION COMPLETED"
|
||||
property string calibrationFailed: "CALIBRATION FAILED"
|
||||
property string instructionText: "Please stand in a T-Pose during calibration"
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
visible: true
|
||||
|
@ -158,6 +159,15 @@ Rectangle {
|
|||
|
||||
onClicked: {
|
||||
restart();
|
||||
statusText.color = hifi.colors.blueHighlight;
|
||||
statusText.text = info.calibratingCountText;
|
||||
directions.text = instructionText;
|
||||
countDown.visible = true;
|
||||
busyIndicator.running = true;
|
||||
busyRotation.from = 0
|
||||
busyRotation.to = 360
|
||||
busyIndicator.source = blueIndicator;
|
||||
closeWindow.stop();
|
||||
numberAnimation.stop();
|
||||
info.count = (timer.interval / 1000);
|
||||
numberAnimation.start();
|
||||
|
@ -178,6 +188,7 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function start(interval, countNumber) {
|
||||
countDown.visible = true;
|
||||
statusText.color = hifi.colors.blueHighlight;
|
||||
|
@ -201,6 +212,7 @@ Rectangle {
|
|||
busyIndicator.running = false;
|
||||
statusText.text = info.calibrationSuccess
|
||||
statusText.color = hifi.colors.greenHighlight
|
||||
directions.text = "SUCCESS"
|
||||
closeWindow.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ Rectangle {
|
|||
width: glyphButton.width + calibrationText.width + padding
|
||||
height: hifi.dimensions.controlLineHeight
|
||||
anchors.top: bottomSeperator.bottom
|
||||
anchors.topMargin: 10
|
||||
anchors.topMargin: 15
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: leftMargin
|
||||
|
||||
|
@ -590,16 +590,24 @@ Rectangle {
|
|||
lastConfiguration = composeConfigurationSettings();
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
var settings = InputConfiguration.configurationSettings(pluginName);
|
||||
var data = {
|
||||
"num_pucks": settings["puckCount"]
|
||||
}
|
||||
UserActivityLogger.logAction("mocap_ui_close_dialog", data);
|
||||
}
|
||||
|
||||
HifiControls.SpinBox {
|
||||
id: timeToCalibrate
|
||||
width: 70
|
||||
anchors.top: calibrationButton.bottom
|
||||
anchors.topMargin: 40
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: leftMargin
|
||||
|
||||
minimumValue: 3
|
||||
value: 3
|
||||
minimumValue: 5
|
||||
value: 5
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
|
||||
onEditingFinished: {
|
||||
|
@ -641,17 +649,39 @@ Rectangle {
|
|||
to: 0
|
||||
}
|
||||
|
||||
function logAction(action, status) {
|
||||
console.log("calibrated from ui");
|
||||
var data = {
|
||||
"num_pucks": status["puckCount"],
|
||||
"puck_configuration": status["configuration"],
|
||||
"head_puck": status["head_puck"],
|
||||
"hand_puck": status["hand_pucks"]
|
||||
}
|
||||
UserActivityLogger.logAction(action, data);
|
||||
}
|
||||
|
||||
function calibrationStatusInfo(status) {
|
||||
var calibrationScreen = stack.currentItem;
|
||||
|
||||
if (!status["UI"]) {
|
||||
calibratingScreen = screen.createObject();
|
||||
stack.push(calibratingScreen);
|
||||
}
|
||||
|
||||
if (status["calibrated"]) {
|
||||
calibrationScreen.success();
|
||||
|
||||
if (status["UI"]) {
|
||||
logAction("mocap_ui_success", status);
|
||||
}
|
||||
|
||||
} else if (!status["calibrated"]) {
|
||||
var uncalibrated = status["success"];
|
||||
if (!uncalibrated) {
|
||||
calibrationScreen.failure();
|
||||
calibrationScreen.failure();
|
||||
|
||||
if (status["UI"]) {
|
||||
logAction("mocap_ui_failed", status);
|
||||
}
|
||||
}
|
||||
|
||||
updateCalibrationButton();
|
||||
}
|
||||
|
||||
|
@ -717,6 +747,12 @@ Rectangle {
|
|||
|
||||
initializeButtonState();
|
||||
updateCalibrationText();
|
||||
|
||||
var data = {
|
||||
"num_pucks": settings["puckCount"]
|
||||
};
|
||||
|
||||
UserActivityLogger.logAction("mocap_ui_open_dialog", data);
|
||||
}
|
||||
|
||||
function displayTrackerConfiguration(type) {
|
||||
|
|
|
@ -284,6 +284,7 @@ ViveControllerManager::InputDevice::InputDevice(vr::IVRSystem*& system) : contro
|
|||
_configStringMap[Config::FeetAndHips] = QString("FeetAndHips");
|
||||
_configStringMap[Config::FeetHipsAndChest] = QString("FeetHipsAndChest");
|
||||
_configStringMap[Config::FeetHipsAndShoulders] = QString("FeetHipsAndShoulders");
|
||||
_configStringMap[Config::FeetHipsChestAndShoulders] = QString("FeetHipsChestAndShoulders");
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
|
@ -360,6 +361,7 @@ void ViveControllerManager::InputDevice::calibrateFromUI(const controller::Input
|
|||
if (_calibrate) {
|
||||
uncalibrate();
|
||||
calibrate(inputCalibrationData);
|
||||
emitCalibrationStatus();
|
||||
_calibrate = false;
|
||||
}
|
||||
}
|
||||
|
@ -407,29 +409,23 @@ QJsonObject ViveControllerManager::InputDevice::configurationSettings() {
|
|||
Locker locker(_lock);
|
||||
QJsonObject configurationSettings;
|
||||
configurationSettings["trackerConfiguration"] = configToString(_preferedConfig);
|
||||
configurationSettings["HMDHead"] = (_headConfig == HeadConfig::HMD) ? true : false;
|
||||
configurationSettings["handController"] = (_handConfig == HandConfig::HandController) ? true : false;
|
||||
configurationSettings["HMDHead"] = (_headConfig == HeadConfig::HMD);
|
||||
configurationSettings["handController"] = (_handConfig == HandConfig::HandController);
|
||||
configurationSettings["puckCount"] = (int)_validTrackedObjects.size();
|
||||
return configurationSettings;
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::emitCalibrationStatus(const bool success) {
|
||||
void ViveControllerManager::InputDevice::emitCalibrationStatus() {
|
||||
auto inputConfiguration = DependencyManager::get<InputConfiguration>();
|
||||
QJsonObject status = QJsonObject();
|
||||
|
||||
if (_calibrated && success) {
|
||||
status["calibrated"] = _calibrated;
|
||||
status["configuration"] = configToString(_preferedConfig);
|
||||
} else if (!_calibrated && !success) {
|
||||
status["calibrated"] = _calibrated;
|
||||
status["success"] = success;
|
||||
} else if (!_calibrated && success) {
|
||||
status["calibrated"] = _calibrated;
|
||||
status["success"] = success;
|
||||
status["configuration"] = configToString(_preferedConfig);
|
||||
status["puckCount"] = (int)_validTrackedObjects.size();
|
||||
}
|
||||
status["calibrated"] = _calibrated;
|
||||
status["configuration"] = configToString(_preferedConfig);
|
||||
status["head_puck"] = (_headConfig == HeadConfig::Puck) ? true : false;
|
||||
status["hand_pucks"] = (_handConfig == HandConfig::Pucks) ? true : false;
|
||||
status["puckCount"] = (int)_validTrackedObjects.size();
|
||||
status["UI"] = _calibrate;
|
||||
|
||||
emit inputConfiguration->calibrationStatus(status); //inputConfiguration->calibrated(status);
|
||||
emit inputConfiguration->calibrationStatus(status);
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
|
@ -472,12 +468,29 @@ void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceInde
|
|||
}
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::sendUserActivityData(QString activity) {
|
||||
QJsonObject jsonData = {
|
||||
{"num_pucks", (int)_validTrackedObjects.size()},
|
||||
{"configuration", configToString(_preferedConfig)},
|
||||
{"head_puck", (_headConfig == HeadConfig::Puck) ? true : false},
|
||||
{"hand_pucks", (_handConfig == HandConfig::Pucks) ? true : false}
|
||||
};
|
||||
|
||||
UserActivityLogger::getInstance().logAction(activity, jsonData);
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::calibrateOrUncalibrate(const controller::InputCalibrationData& inputCalibration) {
|
||||
if (!_calibrated) {
|
||||
calibrate(inputCalibration);
|
||||
if (_calibrated) {
|
||||
sendUserActivityData("mocap_button_success");
|
||||
} else {
|
||||
sendUserActivityData("mocap_button_fail");
|
||||
}
|
||||
emitCalibrationStatus();
|
||||
} else {
|
||||
uncalibrate();
|
||||
emitCalibrationStatus(true);
|
||||
sendUserActivityData("mocap_button_uncalibrate");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,7 +502,6 @@ void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibr
|
|||
|
||||
if (puckCount == 0) {
|
||||
uncalibrate();
|
||||
emitCalibrationStatus(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -508,10 +520,8 @@ void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibr
|
|||
|
||||
if (!headConfigured || !handsConfigured || !bodyConfigured) {
|
||||
uncalibrate();
|
||||
emitCalibrationStatus(false);
|
||||
} else {
|
||||
_calibrated = true;
|
||||
emitCalibrationStatus(true);
|
||||
qDebug() << "PuckCalibration: " << configToString(_config) << " Configuration Successful";
|
||||
}
|
||||
}
|
||||
|
@ -601,8 +611,6 @@ bool ViveControllerManager::InputDevice::configureBody(glm::mat4& defaultToRefer
|
|||
return true;
|
||||
}
|
||||
qDebug() << "Puck Calibration: " << configToString(_config) << " Config Failed: Could not meet the minimal # of pucks";
|
||||
uncalibrate();
|
||||
emitCalibrationStatus(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
void calibrateOrUncalibrate(const controller::InputCalibrationData& inputCalibration);
|
||||
void calibrate(const controller::InputCalibrationData& inputCalibration);
|
||||
void uncalibrate();
|
||||
void sendUserActivityData(QString activity);
|
||||
void configureCalibrationSettings(const QJsonObject configurationSettings);
|
||||
QJsonObject configurationSettings();
|
||||
controller::Pose addOffsetToPuckPose(int joint) const;
|
||||
|
@ -106,7 +107,7 @@ private:
|
|||
void calibrateHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||
void calibrateFromHandController(const controller::InputCalibrationData& inputCalibrationData);
|
||||
void calibrateFromUI(const controller::InputCalibrationData& inputCalibrationData);
|
||||
void emitCalibrationStatus(const bool success);
|
||||
void emitCalibrationStatus();
|
||||
void calibrateNextFrame();
|
||||
|
||||
|
||||
|
@ -139,7 +140,7 @@ private:
|
|||
FeetAndHips,
|
||||
FeetHipsAndChest,
|
||||
FeetHipsAndShoulders,
|
||||
FeetHipsChestAndShoulders,
|
||||
FeetHipsChestAndShoulders
|
||||
};
|
||||
|
||||
enum class HeadConfig {
|
||||
|
|
Loading…
Reference in a new issue