Compare commits

..
7 changed files with 170 additions and 74 deletions

No files matched your search

+4 -46
View File
@@ -207,8 +207,6 @@ jobs:
- name: Run Electron Builder
shell: bash
run: |
set -eo pipefail
mkdir -p gui/electron/dist/artifacts/linux/ \
gui/electron/dist/artifacts/win \
gui/electron/dist/artifacts/mac
@@ -217,51 +215,11 @@ jobs:
VERSION="${VERSION#v}"
echo "Building version: $VERSION"
pnpm i
cd "${{ github.workspace }}/gui/electron"
COMMON_ELECTRON_BUILDER_ARGS=(--config.extraMetadata.version="$VERSION" --publish never)
# If Linux, build rpm and deb before AppImage (so we don't bundle jre for system packages)
pnpm exec electron-builder --${{ matrix.platform }} \
cd gui/electron
pnpm exec electron-builder --${{ matrix.platform }} \
${{ matrix.platform == 'macos' && '--universal' || '' }} \
${{ matrix.platform == 'linux' && 'rpm deb' || ''}} \
${COMMON_ELECTRON_BUILDER_ARGS[@]}
# Fetch JRE from Adoptium and build AppImage
# We have to do this afterward because electron-builder does not have a mechanism to
# only include a file in extraFiles for a specific target (i.e. only for AppImage)
if [[ "${{ matrix.platform }}" == linux ]]; then
pushd resources
# Fetch JRE from Adoptium
JRE_ARCHITECTURE="${{ endsWith(matrix.os, '-arm') && 'aarch64' || 'x64' }}"
LATEST_JRE_INFO="$(curl -f "https://api.adoptium.net/v3/assets/latest/25/hotspot?architecture=$JRE_ARCHITECTURE&image_type=jre&os=linux&vendor=eclipse")"
JRE_VERSION="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].release_name')"
JRE_ARCHIVE_URL="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.link')"
JRE_ARCHIVE_NAME="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.name')"
EXPECTED_JRE_ARCHIVE_CHECKSUM="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.checksum')"
echo "Downloading Adoptium Eclipse JRE version $JRE_VERSION ($JRE_ARCHIVE_URL)"
# Make sure name is not a weird relative path
[[ "$(dirname "$(realpath "$JRE_ARCHIVE_NAME")")" != "$(pwd)" ]] && { echo "JRE archive name is a weird path, refusing to continue" >&2; exit 1; }
# Same with version
[[ "$(dirname "$(realpath "$JRE_VERSION")")" != "$(pwd)" ]] && { echo "JRE version is a weird path, refusing to continue" >&2; exit 1; }
curl -Lf "$JRE_ARCHIVE_URL" -O
[[ ! -f "$JRE_ARCHIVE_NAME" ]] && { echo "JRE archive does not exist with filename $JRE_ARCHIVE_NAME" >&2; exit 1; }
# Make sure checksum matches
JRE_ARCHIVE_CHECKSUM="$(sha256sum "$JRE_ARCHIVE_NAME" | cut -d' ' -f1)"
[[ "$JRE_ARCHIVE_CHECKSUM" != "$EXPECTED_JRE_ARCHIVE_CHECKSUM" ]] && { echo "JRE checksum does not match ($JRE_ARCHIVE_CHECKSUM != $EXPECTED_JRE_ARCHIVE_CHECKSUM)" >&2; exit 1; }
tar -xzf "$JRE_ARCHIVE_NAME"
mv "${JRE_VERSION}-jre" jre
popd
# Now run AppImage build
pnpm exec electron-builder --${{ matrix.platform }} appimage ${COMMON_ELECTRON_BUILDER_ARGS[@]}
fi
--config.extraMetadata.version="$VERSION" \
--publish never
- name: Collect and Rename Artifacts
shell: bash
run: |
+9
View File
@@ -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>
-3
View File
@@ -53,9 +53,6 @@ linux:
to: "."
- from: "./resources/firewall"
to: "firewall"
# Exists in CI when building for AppImage
- from: "./resources/jre"
to: "jre"
icon: "./resources/icons"
deb:
@@ -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,
),
)
},