Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stay Aligned] Add small yaw rotations to keep trackers aligned #1293

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions gui/public/i18n/en/translation.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ widget-imu_visualizer-rotation_raw = Raw rotation
widget-imu_visualizer-rotation_preview = Preview rotation
widget-imu_visualizer-acceleration = Acceleration
widget-imu_visualizer-position = Position
widget-imu_visualizer-stay_aligned = Stay Aligned

## Widget: Skeleton Visualizer
widget-skeleton_visualizer-preview = Skeleton preview
Expand All @@ -209,6 +210,7 @@ tracker-table-column-temperature = Temp. °C
tracker-table-column-linear-acceleration = Accel. X/Y/Z
tracker-table-column-rotation = Rotation X/Y/Z
tracker-table-column-position = Position X/Y/Z
tracker-table-column-stay_aligned = Stay Aligned
tracker-table-column-url = URL

## Tracker rotation
Expand Down Expand Up @@ -338,6 +340,7 @@ mounting_selection_menu-close = Close
settings-sidebar-title = Settings
settings-sidebar-general = General
settings-sidebar-tracker_mechanics = Tracker mechanics
settings-sidebar-stay_aligned = Stay Aligned
settings-sidebar-fk_settings = Tracking settings
settings-sidebar-gesture_control = Gesture control
settings-sidebar-interface = Interface
Expand Down Expand Up @@ -428,6 +431,23 @@ settings-general-tracker_mechanics-use_mag_on_all_trackers-description =
Can be disabled per tracker in the tracker's settings. <b>Please don't shutdown any of the trackers while toggling this!</b>
settings-general-tracker_mechanics-use_mag_on_all_trackers-label = Use magnetometer on trackers

settings-general-stay_aligned = Stay Aligned
settings-general-stay_aligned-description = Keeps your trackers aligned by slowly adjusting the yaw of your trackers.
settings-general-stay_aligned-warnings-drift_compensation = ⚠ Please disable "Drift Compensation". Stay Aligned and Drift Compensation try to solve the same problem and only one should be enabled.
settings-general-stay_aligned-enabled-label = Enabled
settings-general-stay_aligned-amount-label = Maximum yaw adjustment rate
settings-general-stay_aligned-amount-description = Pick a rate depending on how good your IMU is: 0.1 deg/s for ICM45686, LSM6DSV or BNO085; 0.2 deg/s for LSM6DSR or BMI270; and 0.4 deg/s for BMI160.
settings-general-stay_aligned-relaxed_body_angles-label = Relaxed Body Angles
settings-general-stay_aligned-relaxed_body_angles-description = Stay Aligned needs to know your pose when you are relaxed. These angles describe how much you twist your legs and feet outwards. Do a yaw reset, then stand in a relaxed position, and press "Auto detect angles". Repeat while relaxing in a chair, and lying on your back.
settings-general-stay_aligned-relaxed_body_angles-standing-label = Standing
settings-general-stay_aligned-relaxed_body_angles-sitting-label = Sitting in chair
settings-general-stay_aligned-relaxed_body_angles-lying_on_back-label = Lying on back
settings-general-stay_aligned-relaxed_body_angles-upper_leg_angle = Upper leg
settings-general-stay_aligned-relaxed_body_angles-lower_leg_angle = Lower leg
settings-general-stay_aligned-relaxed_body_angles-foot_angle = Foot
settings-general-stay_aligned-relaxed_body_angles-auto_detect = Auto detect angles
settings-general-stay_aligned-relaxed_body_angles-reset = Reset angles

## FK/Tracking settings
settings-general-fk_settings = Tracking settings

Expand Down
3 changes: 3 additions & 0 deletions gui/src/components/settings/SettingsSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export function SettingsSidebar() {
<SettingsLink to="/settings/trackers" scrollTo="mechanics">
{l10n.getString('settings-sidebar-tracker_mechanics')}
</SettingsLink>
<SettingsLink to="/settings/trackers" scrollTo="stayaligned">
{l10n.getString('settings-general-stay_aligned')}
</SettingsLink>
<SettingsLink to="/settings/trackers" scrollTo="fksettings">
{l10n.getString('settings-sidebar-fk_settings')}
</SettingsLink>
Expand Down
59 changes: 58 additions & 1 deletion gui/src/components/settings/pages/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
SettingsResponseT,
SteamVRTrackersSettingT,
TapDetectionSettingsT,
YawCorrectionSettingsT,
} from 'solarxr-protocol';
import { useConfig } from '@/hooks/config';
import { useWebsocketAPI } from '@/hooks/websocket-api';
Expand All @@ -33,8 +34,9 @@ import {
import { HandsWarningModal } from '@/components/settings/HandsWarningModal';
import { MagnetometerToggleSetting } from './MagnetometerToggleSetting';
import { DriftCompensationModal } from '@/components/settings/DriftCompensationModal';
import { StayAlignedSettings } from './components/StayAlignedSettings';

interface SettingsForm {
export interface SettingsForm {
trackers: {
waist: boolean;
chest: boolean;
Expand Down Expand Up @@ -104,6 +106,18 @@ interface SettingsForm {
saveMountingReset: boolean;
resetHmdPitch: boolean;
};
yawCorrectionSettings: {
enabled: boolean;
amountInDegPerSec: number;
standingUpperLegAngle: number;
standingLowerLegAngle: number;
standingFootAngle: number;
sittingUpperLegAngle: number;
sittingLowerLegAngle: number;
sittingFootAngle: number;
lyingOnBackUpperLegAngle: number;
lyingOnBackLowerLegAngle: number;
};
}

const defaultValues: SettingsForm = {
Expand Down Expand Up @@ -171,6 +185,18 @@ const defaultValues: SettingsForm = {
saveMountingReset: false,
resetHmdPitch: false,
},
yawCorrectionSettings: {
enabled: true,
amountInDegPerSec: 0.2,
standingUpperLegAngle: 0.0,
standingLowerLegAngle: 0.0,
standingFootAngle: 0.0,
sittingUpperLegAngle: 0.0,
sittingLowerLegAngle: 0.0,
sittingFootAngle: 0.0,
lyingOnBackUpperLegAngle: 0.0,
lyingOnBackLowerLegAngle: 0.0,
},
};

export function GeneralSettings() {
Expand Down Expand Up @@ -300,6 +326,28 @@ export function GeneralSettings() {
driftCompensation.maxResets = values.driftCompensation.maxResets;
settings.driftCompensation = driftCompensation;

const yawCorrectionSettings = new YawCorrectionSettingsT();
yawCorrectionSettings.enabled = values.yawCorrectionSettings.enabled;
yawCorrectionSettings.amountInDegPerSec =
values.yawCorrectionSettings.amountInDegPerSec;
yawCorrectionSettings.standingUpperLegAngle =
values.yawCorrectionSettings.standingUpperLegAngle;
yawCorrectionSettings.standingLowerLegAngle =
values.yawCorrectionSettings.standingLowerLegAngle;
yawCorrectionSettings.standingFootAngle =
values.yawCorrectionSettings.standingFootAngle;
yawCorrectionSettings.sittingUpperLegAngle =
values.yawCorrectionSettings.sittingUpperLegAngle;
yawCorrectionSettings.sittingLowerLegAngle =
values.yawCorrectionSettings.sittingLowerLegAngle;
yawCorrectionSettings.sittingFootAngle =
values.yawCorrectionSettings.sittingFootAngle;
yawCorrectionSettings.lyingOnBackUpperLegAngle =
values.yawCorrectionSettings.lyingOnBackUpperLegAngle;
yawCorrectionSettings.lyingOnBackLowerLegAngle =
values.yawCorrectionSettings.lyingOnBackLowerLegAngle;
settings.yawCorrectionSettings = yawCorrectionSettings;

if (values.resetsSettings) {
const resetsSettings = new ResetsSettingsT();
resetsSettings.resetMountingFeet =
Expand Down Expand Up @@ -423,6 +471,10 @@ export function GeneralSettings() {
formData.resetsSettings = settings.resetsSettings;
}

if (settings.yawCorrectionSettings) {
formData.yawCorrectionSettings = settings.yawCorrectionSettings;
}

reset({ ...getValues(), ...formData });
});

Expand Down Expand Up @@ -824,6 +876,11 @@ export function GeneralSettings() {
/>
</>
</SettingsPagePaneLayout>
<StayAlignedSettings
getValues={getValues}
setValue={setValue}
control={control}
/>
<SettingsPagePaneLayout
icon={<WrenchIcon></WrenchIcon>}
id="fksettings"
Expand Down
Loading