Skip to content

Commit

Permalink
Prevent log file spam on cor manipulation
Browse files Browse the repository at this point in the history
updated changelog
  • Loading branch information
BuzzteeBear committed Nov 30, 2024
1 parent 387a56c commit 3d8a787
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
27 changes: 15 additions & 12 deletions XR_APILAYER_NOVENDOR_motion_compensation/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace tracker

if (XrPosef curPose; GetPose(curPose, session, time))
{
SetReferencePose(curPose);
SetReferencePose(curPose, false);
TraceLoggingWriteStop(local, "ControllerBase::ResetReferencePose", TLArg(true, "Success"));
return true;
}
Expand All @@ -91,13 +91,16 @@ namespace tracker
return false;
}

void ControllerBase::SetReferencePose(const XrPosef& pose)
void ControllerBase::SetReferencePose(const XrPosef& pose, const bool silent)
{
TraceLocalActivity(local);
TraceLoggingWriteStart(local, "ControllerBase::SetReferencePose", TLArg(xr::ToString(pose).c_str(), "Pose"));

m_ReferencePose = pose;
Log("tracker reference pose set");
if (!silent)
{
Log("tracker reference pose set");
}

TraceLoggingWriteStop(local, "ControllerBase::SetReferencePose");
}
Expand Down Expand Up @@ -515,7 +518,7 @@ namespace tracker
}

const XrPosef adjustment{{Quaternion::Identity()}, modification};
m_ReferencePose = Pose::Multiply(adjustment, m_ReferencePose);
SetReferencePose(Pose::Multiply(adjustment, m_ReferencePose), true);
TraceLoggingWriteStop(local,
"TrackerBase::ChangeOffset",
TLArg(true, "Success"),
Expand All @@ -539,7 +542,7 @@ namespace tracker

XrPosef adjustment{Pose::Identity()};
StoreXrQuaternion(&adjustment.orientation, DirectX::XMQuaternionRotationRollPitchYaw(0.0f, radian, 0.0f));
SetReferencePose(Pose::Multiply(adjustment, m_ReferencePose));
SetReferencePose(Pose::Multiply(adjustment, m_ReferencePose), true);

TraceLoggingWriteStop(local,
"TrackerBase::ChangeRotation",
Expand Down Expand Up @@ -583,15 +586,15 @@ namespace tracker
TraceLoggingWriteStop(local, "TrackerBase::LogCurrentTrackerPose");
}

void TrackerBase::SetReferencePose(const XrPosef& pose)
void TrackerBase::SetReferencePose(const XrPosef& pose, const bool silent)
{
TraceLocalActivity(local);
TraceLoggingWriteStart(local, "TrackerBase::SetReferencePose", TLArg(xr::ToString(pose).c_str(), "Pose"));

m_TransFilter->Reset(pose.position);
m_RotFilter->Reset(pose.orientation);
m_Calibrated = true;
ControllerBase::SetReferencePose(pose);
ControllerBase::SetReferencePose(pose, silent);
if (m_Sampler)
{
m_Sampler->StartSampling();
Expand Down Expand Up @@ -697,7 +700,7 @@ namespace tracker
if (success)
{
Log("reference pose successfully loaded from config file");
SetReferencePose(refPose);
SetReferencePose(refPose, false);
}
TraceLoggingWriteStop(local, "TrackerBase::LoadReferencePose", TLArg(false, "Success"));
return success;
Expand Down Expand Up @@ -1090,7 +1093,7 @@ namespace tracker
}
else
{
TrackerBase::SetReferencePose(xr::Normalize(forward.value()));
TrackerBase::SetReferencePose(xr::Normalize(forward.value()), false);
EventSink::Execute(Event::Calibrated);
}
}
Expand Down Expand Up @@ -1197,13 +1200,13 @@ namespace tracker
return &m_Mmf;
}

void VirtualTracker::SetReferencePose(const ::XrPosef& pose)
void VirtualTracker::SetReferencePose(const ::XrPosef& pose, const bool silent)
{
TraceLocalActivity(local);
TraceLoggingWriteStart(local, "VirtualTracker::SetReferencePose", TLArg(xr::ToString(pose).c_str(), "Pose"));

SetForwardRotation(pose);
TrackerBase::SetReferencePose(pose);
TrackerBase::SetReferencePose(pose, silent);

TraceLoggingWriteStop(local, "VirtualTracker::SetReferencePose");
}
Expand Down Expand Up @@ -1621,7 +1624,7 @@ namespace tracker
{
ApplyTranslation();
ApplyRotation(poseDelta);
SetReferencePose(m_LastPose);
SetReferencePose(m_LastPose, true);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions XR_APILAYER_NOVENDOR_motion_compensation/tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace tracker
virtual bool ResetReferencePose(XrSession session, XrTime time);

protected:
virtual void SetReferencePose(const XrPosef& pose);
virtual void SetReferencePose(const XrPosef& pose, bool silent);
virtual bool GetPose(XrPosef& trackerPose, XrSession session, XrTime time) = 0;
virtual bool GetControllerPose(XrPosef& trackerPose, XrSession session, XrTime time);
static XrVector3f GetForwardVector(const XrQuaternionf& quaternion);
Expand Down Expand Up @@ -57,7 +57,7 @@ namespace tracker
virtual void ModifyStabilizer(bool increase, bool fast);

[[nodiscard]] XrPosef GetReferencePose() const;
void SetReferencePose(const XrPosef& pose) override;
void SetReferencePose(const XrPosef& pose, bool silent) override;
virtual void InvalidateCalibration(bool silent);
virtual void SaveReferencePose() const;
void SaveReferencePoseImpl(const XrPosef& refPose) const;
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace tracker
utility::DataSource* GetSource() override;

protected:
void SetReferencePose(const XrPosef& pose) override;
void SetReferencePose(const XrPosef& pose, bool silent) override;
bool GetPose(XrPosef& trackerPose, XrSession session, XrTime time) override;
std::optional<XrPosef> GetForwardView(XrSession session, XrTime time) override;
virtual bool ReadData(XrTime time, utility::Dof& dof);
Expand Down
9 changes: 5 additions & 4 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ OpenXR-MotionCompensation Changelog
Version 0.3.9.0

General:
- enabled (un)locking reference pose in VR playspace via keyboard shortcut
- enabled locking and unlocking reference pose/cor position in VR playspace via keyboard shortcut

Vive Tracker
- added dedicated config key for role
- added dedicated config key for role (requires edit of config file on update)

Virtual Tracker:
- enabled COR calibration outside of neutral rig position
- changed motion controller buttons to avoid accidental activation via trigger
- enabled use of right motion controller for COR manipulation
- changed motion controller buttons for COR manipulation to avoid accidental trigger activation

Graphcal Overlay:
Graphical Overlay:
- added optional crosshair to help with forward calibration
- display current tracker pose while mc is off

Expand Down

0 comments on commit 3d8a787

Please sign in to comment.