mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 09:29:02 +02:00
add print when device changes tracking result
This commit is contained in:
parent
66020cf446
commit
5042d4d312
2 changed files with 34 additions and 8 deletions
|
@ -29,7 +29,6 @@
|
||||||
#include <glm/ext.hpp>
|
#include <glm/ext.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
|
|
||||||
#include <controllers/UserInputMapper.h>
|
#include <controllers/UserInputMapper.h>
|
||||||
|
|
||||||
#include <controllers/StandardControls.h>
|
#include <controllers/StandardControls.h>
|
||||||
|
@ -67,6 +66,28 @@ static bool sortPucksYPosition(std::pair<uint32_t, controller::Pose> firstPuck,
|
||||||
return (firstPuck.second.translation.y < firstPuck.second.translation.y);
|
return (firstPuck.second.translation.y < firstPuck.second.translation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString deviceTrackingResultToString(vr::ETrackingResult trackingResult) {
|
||||||
|
QString result;
|
||||||
|
switch (trackingResult) {
|
||||||
|
case vr::TrackingResult_Uninitialized:
|
||||||
|
result = "vr::TrackingResult_Uninitialized";
|
||||||
|
break;
|
||||||
|
case vr::TrackingResult_Calibrating_InProgress:
|
||||||
|
result = "vr::TrackingResult_Calibrating_InProgess";
|
||||||
|
break;
|
||||||
|
case vr::TrackingResult_Calibrating_OutOfRange:
|
||||||
|
result = "vr::TrackingResult_Calibrating_OutOfRange";
|
||||||
|
break;
|
||||||
|
case vr::TrackingResult_Running_OK:
|
||||||
|
result = "vr::TrackingResult_Running_OK";
|
||||||
|
break;
|
||||||
|
case vr::TrackingResult_Running_OutOfRange:
|
||||||
|
result = "vr::TrackingResult_Running_OutOfRange";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool ViveControllerManager::isSupported() const {
|
bool ViveControllerManager::isSupported() const {
|
||||||
return openVrSupported();
|
return openVrSupported();
|
||||||
}
|
}
|
||||||
|
@ -212,7 +233,7 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
|
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
|
||||||
uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex;
|
uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex;
|
||||||
|
printDeviceTrackingResultChange(deviceIndex);
|
||||||
if (_system->IsTrackedDeviceConnected(deviceIndex) &&
|
if (_system->IsTrackedDeviceConnected(deviceIndex) &&
|
||||||
_system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_GenericTracker &&
|
_system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_GenericTracker &&
|
||||||
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid &&
|
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid &&
|
||||||
|
@ -222,7 +243,7 @@ void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceInde
|
||||||
vec3 linearVelocity = vec3();
|
vec3 linearVelocity = vec3();
|
||||||
vec3 angularVelocity = vec3();
|
vec3 angularVelocity = vec3();
|
||||||
// check if the device is tracking out of range, then process the correct pose depending on the result.
|
// check if the device is tracking out of range, then process the correct pose depending on the result.
|
||||||
if (_nextSimPoseData.vrPoses[deviceIndex].eTrackingResult != vr::TrackingResult_Running_OutOfRange) {
|
if (_nextSimPoseData.vrPoses[deviceIndex].eTrackingResult != vr::TrackingResult_Running_OutOfRange) {
|
||||||
mat = _nextSimPoseData.poses[deviceIndex];
|
mat = _nextSimPoseData.poses[deviceIndex];
|
||||||
linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
|
linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
|
||||||
angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
|
angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
|
||||||
|
@ -235,13 +256,9 @@ void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceInde
|
||||||
_nextSimPoseData.poses[deviceIndex] = _lastSimPoseData.poses[deviceIndex];
|
_nextSimPoseData.poses[deviceIndex] = _lastSimPoseData.poses[deviceIndex];
|
||||||
_nextSimPoseData.linearVelocities[deviceIndex] = _lastSimPoseData.linearVelocities[deviceIndex];
|
_nextSimPoseData.linearVelocities[deviceIndex] = _lastSimPoseData.linearVelocities[deviceIndex];
|
||||||
_nextSimPoseData.angularVelocities[deviceIndex] = _lastSimPoseData.angularVelocities[deviceIndex];
|
_nextSimPoseData.angularVelocities[deviceIndex] = _lastSimPoseData.angularVelocities[deviceIndex];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* const mat4& mat;
|
|
||||||
const vec3 linearVelocity;
|
|
||||||
const vec3 angularVelocity;*/
|
|
||||||
|
|
||||||
controller::Pose pose(extractTranslation(mat), glmExtractRotation(mat), linearVelocity, angularVelocity);
|
controller::Pose pose(extractTranslation(mat), glmExtractRotation(mat), linearVelocity, angularVelocity);
|
||||||
|
|
||||||
// transform into avatar frame
|
// transform into avatar frame
|
||||||
|
@ -466,6 +483,14 @@ enum ViveButtonChannel {
|
||||||
RIGHT_APP_MENU
|
RIGHT_APP_MENU
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ViveControllerManager::InputDevice::printDeviceTrackingResultChange(uint32_t deviceIndex) {
|
||||||
|
if (_nextSimPoseData.vrPoses[deviceIndex].eTrackingResult != _lastSimPoseData.vrPoses[deviceIndex].eTrackingResult) {
|
||||||
|
qDebug() << "OpenVR: Device" << deviceIndex << "Tracking Result changed from" <<
|
||||||
|
deviceTrackingResultToString(_lastSimPoseData.vrPoses[deviceIndex].eTrackingResult)
|
||||||
|
<< "to" << deviceTrackingResultToString(_nextSimPoseData.vrPoses[deviceIndex].eTrackingResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ViveControllerManager::InputDevice::checkForCalibrationEvent() {
|
bool ViveControllerManager::InputDevice::checkForCalibrationEvent() {
|
||||||
auto& endOfMap = _buttonPressedMap.end();
|
auto& endOfMap = _buttonPressedMap.end();
|
||||||
auto& leftTrigger = _buttonPressedMap.find(controller::LT);
|
auto& leftTrigger = _buttonPressedMap.find(controller::LT);
|
||||||
|
|
|
@ -77,6 +77,7 @@ private:
|
||||||
void handleHeadPoseEvent(const controller::InputCalibrationData& inputCalibrationData, const mat4& mat, const vec3& linearVelocity,
|
void handleHeadPoseEvent(const controller::InputCalibrationData& inputCalibrationData, const mat4& mat, const vec3& linearVelocity,
|
||||||
const vec3& angularVelocity);
|
const vec3& angularVelocity);
|
||||||
void partitionTouchpad(int sButton, int xAxis, int yAxis, int centerPsuedoButton, int xPseudoButton, int yPseudoButton);
|
void partitionTouchpad(int sButton, int xAxis, int yAxis, int centerPsuedoButton, int xPseudoButton, int yPseudoButton);
|
||||||
|
void printDeviceTrackingResultChange(uint32_t deviceIndex);
|
||||||
|
|
||||||
class FilteredStick {
|
class FilteredStick {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue