mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1deaafa7a | ||
|
|
4979f445b8 | ||
|
|
5b7bebe6b7 |
No files matched your search
@@ -569,6 +569,7 @@ settings-driver = SteamVR / Monado
|
||||
settings-driver-description = Settings for the SlimeVR driver, used by SteamVR and Monado alike.
|
||||
settings-driver-output_group = Output
|
||||
settings-driver-data_group = Data sent
|
||||
settings-driver-features_group = Features
|
||||
settings-driver-enable = Enable
|
||||
settings-driver-enable-description = Send your trackers to and receive trackers from SteamVR or Monado through the SlimeVR driver. If this is off, they won't be able to connect to SlimeVR at all.
|
||||
settings-driver-status-title = Status
|
||||
@@ -586,6 +587,14 @@ settings-driver-bones-description = Which bones this output sends is configured
|
||||
settings-driver-bones-link = Open Bone Routing
|
||||
settings-driver-velocity = Send velocity
|
||||
settings-driver-velocity-description = Send linear and angular velocity data to the driver. Allows SteamVR/Monado tracker pose prediction and compatibility with applications that expect this data.
|
||||
settings-driver-controller_tracking_fallback = Controller tracking fallback
|
||||
settings-driver-controller_tracking_fallback-description = Takes over your controllers' tracking when they lose tracking. Requires trackers mounted on your arms and hands.
|
||||
settings-driver-controller_tracking_fallback-pose_deadzone = Pose deadzone
|
||||
settings-driver-controller_tracking_fallback-pose_deadzone-description = How far the controller and hand tracker positions need to diverge before the hand tracker takes over controller tracking.
|
||||
settings-driver-controller_tracking_fallback-interpolation = Interpolate on override begin
|
||||
settings-driver-controller_tracking_fallback-interpolation-description = Smoothly transition from the controller's last good pose toward your hand tracker's pose when it starts taking over.
|
||||
settings-driver-controller_tracking_fallback-interpolation_range = Maximum interpolation range
|
||||
settings-driver-controller_tracking_fallback-interpolation_range-description = The maximum allowed range (difference between controller and hand tracker position) interpolation should be performed within; as the difference between the two gets closer to the maximum range, the takeover pose will be closer to the pose from your hand tracker.
|
||||
|
||||
## Tracker mechanics
|
||||
settings-general-mounting_method = Mounting calibration method
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { FieldPath, useForm } from 'react-hook-form';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import {
|
||||
ChangeDriverSettingsRequestT,
|
||||
@@ -29,16 +29,30 @@ import {
|
||||
} from '@/components/settings/SettingRow';
|
||||
import { SteamIcon } from '@/components/commons/icon/SteamIcon';
|
||||
import { defineSettingsPage } from '@/components/settings/settings-definitions';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import { NumberSelector } from '@/components/commons/NumberSelector';
|
||||
|
||||
type DriverForm = {
|
||||
enabled: boolean;
|
||||
sendVelocity: boolean;
|
||||
controllerTrackingFallback: {
|
||||
enabled: boolean;
|
||||
poseDeadzone: number;
|
||||
interpolation: boolean;
|
||||
interpolationRange: number;
|
||||
};
|
||||
};
|
||||
|
||||
function toForm(settings: DriverSettingsResponseT): DriverForm {
|
||||
return {
|
||||
enabled: settings.enabled,
|
||||
sendVelocity: settings.sendVelocity,
|
||||
controllerTrackingFallback: {
|
||||
enabled: settings.controllerTrackingFallback,
|
||||
poseDeadzone: settings.controllerTrackingFallbackPoseDeadzone,
|
||||
interpolation: settings.controllerTrackingFallbackInterpolation,
|
||||
interpolationRange: settings.controllerTrackingFallbackInterpolationRange,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,6 +124,32 @@ export const driverSettingsPage = defineSettingsPage({
|
||||
},
|
||||
},
|
||||
},
|
||||
features: {
|
||||
title: 'settings-driver-features_group',
|
||||
rows: {
|
||||
controllerTrackingFallback: {
|
||||
title: 'settings-driver-controller_tracking_fallback',
|
||||
description:
|
||||
'settings-driver-controller_tracking_fallback-description',
|
||||
},
|
||||
controllerTrackingFallbackPoseDeadzone: {
|
||||
title: 'settings-driver-controller_tracking_fallback-pose_deadzone',
|
||||
description:
|
||||
'settings-driver-controller_tracking_fallback-pose_deadzone-description',
|
||||
},
|
||||
controllerTrackingFallbackInterpolation: {
|
||||
title: 'settings-driver-controller_tracking_fallback-interpolation',
|
||||
description:
|
||||
'settings-driver-controller_tracking_fallback-interpolation-description',
|
||||
},
|
||||
controllerTrackingFallbackInterpolationRange: {
|
||||
title:
|
||||
'settings-driver-controller_tracking_fallback-interpolation_range',
|
||||
description:
|
||||
'settings-driver-controller_tracking_fallback-interpolation_range-description',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -122,6 +162,7 @@ export function DriverSettings() {
|
||||
const [status, setStatus] = useState<DriverStatusChangeResponseT | null>(
|
||||
null
|
||||
);
|
||||
const { currentLocales } = useLocaleConfig();
|
||||
const { sendRPCPacket, useRPCPacket, useConnectedEffect } = useWebsocketAPI();
|
||||
const defaults = useSettingsDefaults().driver;
|
||||
|
||||
@@ -137,14 +178,23 @@ export function DriverSettings() {
|
||||
const settingsReq = new ChangeDriverSettingsRequestT();
|
||||
settingsReq.enabled = values.enabled;
|
||||
settingsReq.sendVelocity = values.sendVelocity;
|
||||
settingsReq.controllerTrackingFallback =
|
||||
values.controllerTrackingFallback.enabled;
|
||||
settingsReq.controllerTrackingFallbackPoseDeadzone =
|
||||
values.controllerTrackingFallback.poseDeadzone;
|
||||
settingsReq.controllerTrackingFallbackInterpolation =
|
||||
values.controllerTrackingFallback.interpolation;
|
||||
settingsReq.controllerTrackingFallbackInterpolationRange =
|
||||
values.controllerTrackingFallback.interpolationRange;
|
||||
sendRPCPacket(RpcMessage.ChangeDriverSettingsRequest, settingsReq);
|
||||
};
|
||||
|
||||
const enabled = watch('enabled');
|
||||
|
||||
const resetTo = (name: keyof DriverForm) =>
|
||||
settingReset<DriverForm, typeof name>(
|
||||
defaults?.[name],
|
||||
const resetTo = (name: FieldPath<DriverForm>) =>
|
||||
settingReset<DriverForm, FieldPath<DriverForm>>(
|
||||
name.split('.').reduce<any>((value, key) => value?.[key], defaults) ??
|
||||
undefined,
|
||||
watch(name),
|
||||
(next) => {
|
||||
setValue(name, next);
|
||||
@@ -182,6 +232,52 @@ export function DriverSettings() {
|
||||
(res: DriverStatusChangeResponseT) => setStatus(res)
|
||||
);
|
||||
|
||||
const metresFormat = new Intl.NumberFormat(currentLocales, {
|
||||
style: 'unit',
|
||||
unit: 'meter',
|
||||
unitDisplay: 'narrow',
|
||||
maximumFractionDigits: 2,
|
||||
});
|
||||
|
||||
const toggle = (name: FieldPath<DriverForm>) => ({
|
||||
...resetTo(name),
|
||||
controlId: `driver-${name}`,
|
||||
control: (
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
control={control}
|
||||
name={name}
|
||||
id={`tracking-${name}`}
|
||||
/>
|
||||
),
|
||||
});
|
||||
const stepper = (
|
||||
name: FieldPath<DriverForm>,
|
||||
numberFormat: Intl.NumberFormat,
|
||||
min: number,
|
||||
max: number,
|
||||
step: number
|
||||
) => ({
|
||||
...resetTo(name),
|
||||
controlWidth: 'wide' as const,
|
||||
control: (
|
||||
<NumberSelector
|
||||
control={control}
|
||||
name={name}
|
||||
valueLabelFormat={(value) => numberFormat.format(value)}
|
||||
min={min}
|
||||
max={max}
|
||||
step={step}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
const controllerTrackingFallback = watch(
|
||||
'controllerTrackingFallback.enabled'
|
||||
);
|
||||
const controllerTrackingFallbackInterpolation = watch(
|
||||
'controllerTrackingFallback.interpolation'
|
||||
);
|
||||
return (
|
||||
<SettingsPagePaneLayout
|
||||
icon={<SteamIcon size={24} />}
|
||||
@@ -195,16 +291,7 @@ export function DriverSettings() {
|
||||
<SettingsGroup group={groups.output}>
|
||||
<SettingRow
|
||||
setting={groups.output.rows.enable}
|
||||
controlId="driver-enabled"
|
||||
{...resetTo('enabled')}
|
||||
control={
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
control={control}
|
||||
name="enabled"
|
||||
id="driver-enabled"
|
||||
/>
|
||||
}
|
||||
{...toggle('enabled')}
|
||||
/>
|
||||
<SettingRow
|
||||
setting={groups.output.rows.bones}
|
||||
@@ -232,18 +319,51 @@ export function DriverSettings() {
|
||||
<SettingsGroup group={groups.data}>
|
||||
<SettingRow
|
||||
setting={groups.data.rows.velocity}
|
||||
controlId="driver-velocity"
|
||||
{...resetTo('sendVelocity')}
|
||||
control={
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
control={control}
|
||||
name="sendVelocity"
|
||||
id="driver-velocity"
|
||||
/>
|
||||
}
|
||||
{...toggle('sendVelocity')}
|
||||
/>
|
||||
</SettingsGroup>
|
||||
|
||||
<SettingsGroup group={groups.features}>
|
||||
<SettingRow
|
||||
setting={groups.features.rows.controllerTrackingFallback}
|
||||
{...toggle('controllerTrackingFallback.enabled')}
|
||||
childrenDisabled={!controllerTrackingFallback}
|
||||
>
|
||||
<SettingRow
|
||||
setting={
|
||||
groups.features.rows.controllerTrackingFallbackPoseDeadzone
|
||||
}
|
||||
{...stepper(
|
||||
'controllerTrackingFallback.poseDeadzone',
|
||||
metresFormat,
|
||||
0.1,
|
||||
5.0,
|
||||
0.1
|
||||
)}
|
||||
/>
|
||||
<SettingRow
|
||||
setting={
|
||||
groups.features.rows.controllerTrackingFallbackInterpolation
|
||||
}
|
||||
{...toggle('controllerTrackingFallback.interpolation')}
|
||||
childrenDisabled={!controllerTrackingFallbackInterpolation}
|
||||
>
|
||||
<SettingRow
|
||||
setting={
|
||||
groups.features.rows
|
||||
.controllerTrackingFallbackInterpolationRange
|
||||
}
|
||||
{...stepper(
|
||||
'controllerTrackingFallback.interpolationRange',
|
||||
metresFormat,
|
||||
0.2,
|
||||
6.0,
|
||||
0.1
|
||||
)}
|
||||
/>
|
||||
</SettingRow>
|
||||
</SettingRow>
|
||||
</SettingsGroup>
|
||||
</SettingsAdvanced>
|
||||
</div>
|
||||
</SettingsPagePaneLayout>
|
||||
|
||||
@@ -46,6 +46,10 @@ data class BoneRoutingConfig(
|
||||
data class DriverConfig(
|
||||
val enabled: Boolean = true,
|
||||
val sendVelocity: Boolean = false,
|
||||
val controllerTrackingFallback: Boolean = false,
|
||||
val controllerTrackingFallbackPoseDeadzone: Float = 0.2f,
|
||||
val controllerTrackingFallbackInterpolation: Boolean = true,
|
||||
val controllerTrackingFallbackInterpolationRange: Float = 0.5f,
|
||||
)
|
||||
|
||||
// Used in TrackerActionConfig
|
||||
|
||||
@@ -24,6 +24,10 @@ import solarxr_protocol.rpc.RoutingOutputState
|
||||
internal fun buildDriverSettingsResponse(config: DriverConfig) = DriverSettingsResponse(
|
||||
enabled = config.enabled,
|
||||
sendVelocity = config.sendVelocity,
|
||||
controllerTrackingFallback = config.controllerTrackingFallback,
|
||||
controllerTrackingFallbackPoseDeadzone = config.controllerTrackingFallbackPoseDeadzone,
|
||||
controllerTrackingFallbackInterpolation = config.controllerTrackingFallbackInterpolation,
|
||||
controllerTrackingFallbackInterpolationRange = config.controllerTrackingFallbackInterpolationRange,
|
||||
)
|
||||
|
||||
class DriverSettingsBehaviour(
|
||||
@@ -50,6 +54,10 @@ class DriverSettingsBehaviour(
|
||||
driverConfig = driverConfig.copy(
|
||||
enabled = req.enabled,
|
||||
sendVelocity = req.sendVelocity,
|
||||
controllerTrackingFallback = req.controllerTrackingFallback,
|
||||
controllerTrackingFallbackPoseDeadzone = req.controllerTrackingFallbackPoseDeadzone,
|
||||
controllerTrackingFallbackInterpolation = req.controllerTrackingFallbackInterpolation,
|
||||
controllerTrackingFallbackInterpolationRange = req.controllerTrackingFallbackInterpolationRange,
|
||||
),
|
||||
)
|
||||
},
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: 77cabf5dd8...dd04e409c9.
Reference in new issue
Block a user