* 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
This commit is contained in:
ykeara
2024-03-29 01:09:46 -05:00
committed by GitHub
parent 3c856a5087
commit 72e91e9116
8 changed files with 84 additions and 130 deletions
+68 -18
View File
@@ -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() )
@@ -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();
@@ -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 );
@@ -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;
@@ -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();
}
}
@@ -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;