Skip to content

Commit

Permalink
5.8.11 (#668)
Browse files Browse the repository at this point in the history
* change fix floor re-center to just be standard recenter

* add some error handling around calibration state, force chaperone to live state on 0 offset

* fix commit

* Changed fix floor functions to operate off of move center controller

* add cur offset to center rebased to move center tab controller

* update version number

* fix initialization issue for universe center

* add check to re-initialize if calibration state is not yet set i.e. lighthouse sleep

* increment version number, slight change for specifically 200 error

* remove commented code

* fix conversion error warning
  • Loading branch information
ykeara authored Mar 29, 2024
1 parent 3c856a5 commit 72e91e9
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 130 deletions.
2 changes: 1 addition & 1 deletion build_scripts/compile_version_string.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.9-release
5.8.11-release
89 changes: 5 additions & 84 deletions src/overlaycontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,23 +861,6 @@ void OverlayController::setExclusiveInputEnabled( bool value, bool notify )
emit exclusiveInputEnabledChanged( value );
}
}

/*void OverlayController::setOpenXRFixEnabled( bool value, bool notify )
{
settings::setSetting( settings::BoolSetting::APPLICATION_openXRWorkAround,
value );
if ( notify )
{
emit openXRFixEnabledChanged( value );
}
}
bool OverlayController::openXRFixEnabled() const
{
return settings::getSetting(
settings::BoolSetting::APPLICATION_openXRWorkAround );
}*/

void OverlayController::setAutoApplyChaperoneEnabled( bool value, bool notify )
{
settings::setSetting( settings::BoolSetting::APPLICATION_autoApplyChaperone,
Expand Down Expand Up @@ -1268,6 +1251,11 @@ void OverlayController::mainEventLoop()
m_chaperoneUtils.loadChaperoneData();
chaperoneDataAlreadyUpdated = true;
}
if ( previousUniverseId == 0
&& !m_moveCenterTabController.isInitComplete() )
{
m_moveCenterTabController.zeroOffsets();
}
}
break;
case vr::VREvent_Input_ActionManifestReloaded:
Expand Down Expand Up @@ -1359,73 +1347,6 @@ void OverlayController::mainEventLoop()
}
}

void OverlayController::AddOffsetToUniverseCenter(
vr::ETrackingUniverseOrigin universe,
unsigned axisId,
float offset,
bool adjustBounds,
bool commit )
{
float offsetArray[3] = { 0, 0, 0 };
offsetArray[axisId] = offset;
AddOffsetToUniverseCenter( universe, offsetArray, adjustBounds, commit );
}

void OverlayController::AddOffsetToUniverseCenter(
vr::ETrackingUniverseOrigin universe,
float offset[3],
bool adjustBounds,
bool commit )
{
if ( offset[0] != 0.0f || offset[1] != 0.0f || offset[2] != 0.0f )
{
if ( commit )
{
vr::VRChaperoneSetup()->HideWorkingSetPreview();
vr::VRChaperoneSetup()->RevertWorkingCopy();
}
vr::HmdMatrix34_t curPos;
if ( universe == vr::TrackingUniverseStanding )
{
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&curPos );
}
else
{
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(
&curPos );
}
for ( int i = 0; i < 3; i++ )
{
curPos.m[0][3] += curPos.m[0][i] * offset[i];
curPos.m[1][3] += curPos.m[1][i] * offset[i];
curPos.m[2][3] += curPos.m[2][i] * offset[i];
}
if ( universe == vr::TrackingUniverseStanding )
{
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(
&curPos );
}
else
{
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(
&curPos );
}
if ( adjustBounds && universe == vr::TrackingUniverseStanding )
{
float collisionOffset[] = { -offset[0], -offset[1], -offset[2] };
AddOffsetToCollisionBounds( collisionOffset, false );
}
if ( commit )
{
vr::VRChaperoneSetup()->CommitWorkingCopy(
vr::EChaperoneConfigFile_Live );
vr::VRChaperoneSetup()->ReloadFromDisk(
vr::EChaperoneConfigFile_Temp );
}
}
}

void OverlayController::RotateUniverseCenter(
vr::ETrackingUniverseOrigin universe,
float yAngle,
Expand Down
9 changes: 0 additions & 9 deletions src/overlaycontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,6 @@ class OverlayController : public QObject
const std::string& name,
const std::string& key = "" );

void AddOffsetToUniverseCenter( vr::ETrackingUniverseOrigin universe,
unsigned axisId,
float offset,
bool adjustBounds = true,
bool commit = true );
void AddOffsetToUniverseCenter( vr::ETrackingUniverseOrigin universe,
float offset[3],
bool adjustBounds = true,
bool commit = true );
void RotateUniverseCenter( vr::ETrackingUniverseOrigin universe,
float yAngle,
bool adjustBounds = true,
Expand Down
2 changes: 1 addition & 1 deletion src/res/qml/FixFloorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ MyStackViewPage {
text: "Apply Space Settings Offsets as Center"
Layout.preferredHeight: 80
onClicked: {
MoveCenterTabController.zeroOffsets()
MoveCenterTabController.addCurOffsetAsCenter()
}
}

Expand Down
20 changes: 4 additions & 16 deletions src/tabcontrollers/FixFloorTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ void FixFloorTabController::dashboardLoopTick(
offset[0] = floorOffsetX;
offset[2] = floorOffsetZ;
}
parent->AddOffsetToUniverseCenter(
vr::TrackingUniverseStanding, offset, true );
parent->m_moveCenterTabController.addOffset( offset );
statusMessage
= ( state == 2 ) ? "Recentering ... Ok" : "Fixing ... OK";
statusMessageTimeout = 1.0;
Expand Down Expand Up @@ -302,24 +301,13 @@ void FixFloorTabController::fixFloorClicked()

void FixFloorTabController::recenterClicked()
{
parent->m_moveCenterTabController.reset();
statusMessage = "Fixing ...";
statusMessageTimeout = 1.0;
emit statusMessageSignal();
emit measureStartSignal();
measurementCount = 0;
state = 2;
parent->m_moveCenterTabController.sendSeatedRecenter();
}

void FixFloorTabController::undoFixFloorClicked()
{
parent->m_moveCenterTabController.reset();
parent->AddOffsetToUniverseCenter(
vr::TrackingUniverseStanding, 0, -floorOffsetX, false );
parent->AddOffsetToUniverseCenter(
vr::TrackingUniverseStanding, 1, -floorOffsetY, false );
parent->AddOffsetToUniverseCenter(
vr::TrackingUniverseStanding, 2, -floorOffsetZ, false );
float off[3] = { -floorOffsetX, -floorOffsetY, -floorOffsetZ };
parent->m_moveCenterTabController.addOffset( off );
LOG( INFO ) << "Fix Floor: Undo Floor Offset = [" << -floorOffsetX << ", "
<< -floorOffsetY << ", " << -floorOffsetZ << "]";
floorOffsetY = 0.0f;
Expand Down
86 changes: 68 additions & 18 deletions src/tabcontrollers/MoveCenterTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,27 @@ void MoveCenterTabController::applyOffsetProfile( unsigned index )
}
}

void MoveCenterTabController::addOffset( float offset[] )
{
m_universeCenterForReset.m[0][3] += offset[0];
m_universeCenterForReset.m[1][3] += offset[1];
m_universeCenterForReset.m[2][3] += offset[2];

m_seatedCenterForReset.m[0][3] += offset[0];
m_seatedCenterForReset.m[1][3] += offset[1];
m_seatedCenterForReset.m[2][3] += offset[2];

updateSpace( true );
}

void MoveCenterTabController::addCurOffsetAsCenter()
{
float off[3] = { -m_offsetX, m_offsetY, -m_offsetZ };
// zeroOffsets();
resetOffsets( true );
addOffset( off );
}

void MoveCenterTabController::deleteOffsetProfile( unsigned index )
{
if ( index < m_offsetProfiles.size() )
Expand Down Expand Up @@ -1097,18 +1118,25 @@ void MoveCenterTabController::zeroOffsets()
setTrackingUniverse( vr::VRCompositor()->GetTrackingSpace() );
if ( parent->isPreviousShutdownSafe() )
{
// all init complete, safe to autosave chaperone profile
parent->m_chaperoneTabController.createNewAutosaveProfile();
m_initComplete = true;
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State after autosave profile is: "
<< calState;
if ( calState == 200 )
{
LOG( WARNING )
<< "Chaperone State Does Not Exist Yet, will wait for "
"universe change to finish initialization";
}
else
{
// all init complete, safe to autosave chaperone profile
parent->m_chaperoneTabController.createNewAutosaveProfile();
m_initComplete = true;
}
}
else
{
// shutdown was unsafe last session!
LOG( WARNING ) << "DETECTED UNSAFE SHUTDOWN FROM LAST SESSION";
m_initComplete = true;
m_initComplete = false;
if ( !parent->crashRecoveryDisabled() )
{
parent->m_chaperoneTabController.applyAutosavedProfile();
Expand Down Expand Up @@ -1165,8 +1193,18 @@ void MoveCenterTabController::clampVelocity( double* velocity )

void MoveCenterTabController::updateChaperoneResetData()
{
// TODO
// vr::VRChaperoneSetup()->RevertWorkingCopy();
auto cstate = vr::VRChaperone()->GetCalibrationState();
if ( cstate > 199 )
{
LOG( WARNING ) << "Chaperone Calibration State is error: " << cstate
<< " While Trying to Update Reset Data";
}
else
{
vr::VRChaperoneSetup()->CommitWorkingCopy(
vr::EChaperoneConfigFile_Live );
vr::VRChaperoneSetup()->RevertWorkingCopy();
}
unsigned currentQuadCount = 0;
vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo( nullptr,
&currentQuadCount );
Expand Down Expand Up @@ -1857,16 +1895,6 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed )
// of keyboard input.
if ( resetOffsetsJustPressed )
{
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State on Reset Offsets is: " << calState;

if ( calState > 199 && m_initComplete )
{
LOG( INFO ) << "Chaperone calibration state is error, attempting "
"to apply autosaved profile to fix issue";
parent->m_chaperoneTabController.applyAutosavedProfile();
}

m_offsetX = 0.0f;
m_offsetY = 0.0f;
m_offsetZ = 0.0f;
Expand All @@ -1876,6 +1904,16 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed )
emit offsetZChanged( m_offsetZ );
emit rotationChanged( m_rotation );
updateSpace( true );
auto calState = vr::VRChaperone()->GetCalibrationState();
LOG( INFO ) << "Calibration State on Reset Offsets is: " << calState;

// if ( calState > 199 && m_initComplete )
// {
// LOG( INFO ) << "Chaperone calibration state is error,
// attempting "
// "to apply autosaved profile to fix issue";
// parent->m_chaperoneTabController.applyAutosavedProfile();
// }
// reset();
}
}
Expand Down Expand Up @@ -2478,6 +2516,18 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
{
return;
}
if ( ( abs( m_offsetX ) + abs( m_offsetY ) + abs( m_offsetZ )
+ abs( static_cast<float>( m_rotation ) ) )
== 0
&& !forceUpdate )
{
if ( m_chaperoneHasCommit )
{
m_chaperoneHasCommit = true;
updateChaperoneResetData();
}
}
m_chaperoneHasCommit = false;

vr::HmdMatrix34_t offsetUniverseCenter;

Expand Down
4 changes: 4 additions & 0 deletions src/tabcontrollers/MoveCenterTabController.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class MoveCenterTabController : public QObject
unsigned m_dragComfortFrameSkipCounter = 0;
unsigned m_turnComfortFrameSkipCounter = 0;
int m_recenterStages = 0;
int m_chaperoneHasCommit = false;

// Matrix used For Center Marker
vr::HmdMatrix34_t m_offsetmatrix = utils::k_forwardUpMatrix;
Expand Down Expand Up @@ -279,6 +280,8 @@ class MoveCenterTabController : public QObject
Q_INVOKABLE unsigned getOffsetProfileCount();
Q_INVOKABLE QString getOffsetProfileName( unsigned index );

void addOffset( float offset[3] );

// actions:
void leftHandSpaceDrag( bool leftHandDragActive );
void rightHandSpaceDrag( bool rightHandDragActive );
Expand Down Expand Up @@ -353,6 +356,7 @@ public slots:
void addOffsetProfile( QString name );
void applyOffsetProfile( unsigned index );
void deleteOffsetProfile( unsigned index );
void addCurOffsetAsCenter();

signals:
void trackingUniverseChanged( int value );
Expand Down
2 changes: 1 addition & 1 deletion ver/versioncheck.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "major": 5, "minor": 8, "patch": 9, "updateMessage": "", "optionalMessage": "" }
{ "major": 5, "minor": 8, "patch": 11, "updateMessage": "", "optionalMessage": "" }

0 comments on commit 72e91e9

Please sign in to comment.