Skip to content

Commit

Permalink
Better tracker override check scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Oct 8, 2022
1 parent fb9adf5 commit 6bde4b9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 43 deletions.
63 changes: 32 additions & 31 deletions Amethyst/GeneralPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ void skeleton_visibility_set_ui(const bool& v)
if (!general_tab_setup_finished)return; // Don't even care if we're not set up yet
skeletonToggleButton->IsChecked(v);
skeletonToggleButton->Content(box_value(v
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Hide"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Show"))));
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Hide"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Show"))));

forceRenderCheckBox->IsEnabled(v);
forceRenderText->Opacity(v ? 1.0 : 0.5);
Expand Down Expand Up @@ -1092,14 +1092,14 @@ void Amethyst::implementation::GeneralPage::GeneralPage_Loaded_Handler()
// Setup the freeze button
toggleFreezeButton->IsChecked(k2app::interfacing::isTrackingFrozen);
toggleFreezeButton->Content(k2app::interfacing::isTrackingFrozen
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Unfreeze"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Freeze")));
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Unfreeze"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/Skeleton/Freeze")));

// Set up the co/re/disconnect button
if (!k2app::interfacing::K2AppTrackersSpawned)
Expand All @@ -1114,14 +1114,14 @@ void Amethyst::implementation::GeneralPage::GeneralPage_Loaded_Handler()
{
toggleTrackersButton->IsChecked(k2app::interfacing::K2AppTrackersInitialized);
toggleTrackersButton->Content(k2app::interfacing::K2AppTrackersInitialized
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/TrackersToggle/Disconnect"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/TrackersToggle/Reconnect")));
? box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/TrackersToggle/Disconnect"))
: box_value(
k2app::interfacing::LocalizedResourceWString(
L"GeneralPage",
L"Buttons/TrackersToggle/Reconnect")));
}

freezeOnlyLowerToggle->IsChecked(k2app::K2Settings.freezeLowerOnly);
Expand Down Expand Up @@ -1286,11 +1286,12 @@ std::pair<bool, bool> IsJointUsedAsOverride(const uint32_t& joint)

std::pair<bool, bool> IsJointOverriden(const uint32_t& joint)
{
return (k2app::K2Settings.overrideDeviceGUIDsMap.empty())
? std::make_pair(false, false)
: std::make_pair(
return k2app::K2Settings.overrideDeviceGUIDsMap.contains(
k2app::K2Settings.K2TrackersVector.at(joint).overrideGUID)
? std::make_pair(
k2app::K2Settings.K2TrackersVector.at(joint).isPositionOverridden,
k2app::K2Settings.K2TrackersVector.at(joint).isRotationOverridden);
k2app::K2Settings.K2TrackersVector.at(joint).isRotationOverridden)
: std::make_pair(false, false);
}


Expand Down Expand Up @@ -1676,7 +1677,7 @@ void Amethyst::implementation::GeneralPage::CalibrationButton_Click(
NoCalibrationTeachingTip().IsOpen(true);

Sleep(300);

// Give up
return;
}
Expand Down Expand Up @@ -1827,7 +1828,7 @@ void Amethyst::implementation::GeneralPage::CalibrationButton_Click(
NoCalibrationTeachingTip().IsOpen(true);

Sleep(300);

// Give up
return;
}
Expand Down Expand Up @@ -2187,7 +2188,7 @@ Amethyst::implementation::GeneralPage::TrackingDeviceTreeView_ItemInvoked(
NoCalibrationTeachingTip().IsOpen(true);

Sleep(300);

// Give up
co_return;
}
Expand Down
6 changes: 3 additions & 3 deletions Amethyst/K2AppTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ namespace k2app
) const
{
// Construct the current pose
Eigen::Vector3d m_pose(
const Eigen::Vector3d m_pose(
getFilteredPosition(filter).x(),
getFilteredPosition(filter).y(),
getFilteredPosition(filter).z()
Expand All @@ -373,7 +373,7 @@ namespace k2app
colwise() + translationVector + calibration_origin;

// Construct the calibrated pose in eigen
Eigen::Vector3d calibrated_pose_gl(
const Eigen::Vector3d calibrated_pose_gl(
m_pose_calibrated(0),
m_pose_calibrated(1),
m_pose_calibrated(2)
Expand Down Expand Up @@ -401,7 +401,7 @@ namespace k2app
colwise() + translationVector + calibration_origin;

// Construct the calibrated pose in eigen
Eigen::Vector3d calibrated_vector_gl(
const Eigen::Vector3d calibrated_vector_gl(
vector_calibrated(0),
vector_calibrated(1),
vector_calibrated(2)
Expand Down
19 changes: 10 additions & 9 deletions Amethyst/K2Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ namespace k2app::main
// If the tracker is off
if (!tracker.data_isActive) continue;

// If not overridden by second device
if (!tracker.isPositionOverridden || K2Settings.overrideDeviceGUIDsMap.empty())
// If overridden by second device
if (tracker.isPositionOverridden &&
K2Settings.overrideDeviceGUIDsMap.contains(tracker.overrideGUID))
{
if (K2Settings.deviceMatricesCalibrated[
K2Settings.trackingDeviceGUIDPair.first])
Expand All @@ -393,11 +394,11 @@ namespace k2app::main
tracker.getTrackerBase
(
K2Settings.deviceCalibrationRotationMatrices[
K2Settings.trackingDeviceGUIDPair.first],
tracker.overrideGUID],
K2Settings.deviceCalibrationTranslationVectors[
K2Settings.trackingDeviceGUIDPair.first],
tracker.overrideGUID],
K2Settings.deviceCalibrationOrigins[
K2Settings.trackingDeviceGUIDPair.first],
tracker.overrideGUID],

tracker.positionTrackingFilterOption,
tracker.orientationTrackingFilterOption
Expand All @@ -411,7 +412,7 @@ namespace k2app::main
));
}

// If overriden by another device
// If not overriden by another device
else
{
if (K2Settings.deviceMatricesCalibrated[
Expand All @@ -421,11 +422,11 @@ namespace k2app::main
tracker.getTrackerBase
(
K2Settings.deviceCalibrationRotationMatrices[
tracker.overrideGUID],
K2Settings.trackingDeviceGUIDPair.first],
K2Settings.deviceCalibrationTranslationVectors[
tracker.overrideGUID],
K2Settings.trackingDeviceGUIDPair.first],
K2Settings.deviceCalibrationOrigins[
tracker.overrideGUID],
K2Settings.trackingDeviceGUIDPair.first],

tracker.positionTrackingFilterOption,
tracker.orientationTrackingFilterOption
Expand Down

0 comments on commit 6bde4b9

Please sign in to comment.