Compare commits

...
20 changed files with 88 additions and 36 deletions

No files matched your search

+1
View File
@@ -96,6 +96,7 @@
expat
libayatana-appindicator
libusb1
libudev-zero
])
++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
+1 -1
View File
@@ -835,7 +835,7 @@ onboarding-automatic_proportions-check_height-title = Check your height
onboarding-automatic_proportions-check_height-description = We use your height as a basis of our measurements by using the headset's (HMD) height as an approximation of your actual height, but it's better to check if they are right yourself!
# All the text is in bold!
onboarding-automatic_proportions-check_height-calculation_warning = Please press the button while standing <u>upright</u> to calculate your height. You have 3 seconds after you press the button!
onboarding-automatic_proportions-check_height-guardian_tip = If you are using a standalone VR headset, make sure to have your guardian/
onboarding-automatic_proportions-check_height-guardian_tip = If you are using a standalone VR headset, make sure to have your guardian /
boundary turned on so that your height is correct!
onboarding-automatic_proportions-check_height-fetch_height = I'm standing!
# Context is that the height is unknown
+2 -1
View File
@@ -27,6 +27,7 @@
"shell:allow-open",
"store:allow-get",
"store:allow-set",
"store:allow-save"
"store:allow-save",
"fs:allow-write-text-file"
]
}
+1 -1
View File
@@ -191,7 +191,7 @@ fn main() -> Result<()> {
)
.title("SlimeVR")
.inner_size(1289.0, 709.0)
.min_inner_size(393.0, 667.0)
.min_inner_size(util::MIN_WINDOW_SIZE_WIDTH, util::MIN_WINDOW_SIZE_HEIGHT)
.resizable(true)
.visible(true)
.decorations(false)
+7 -1
View File
@@ -4,6 +4,8 @@ use color_eyre::Result;
use serde::{Deserialize, Serialize};
use tauri::{LogicalSize, Monitor, PhysicalPosition, PhysicalSize, Window};
use crate::util;
static STATE_FILENAME: &str = ".window-state.json";
#[derive(Serialize, Deserialize, Debug, Default)]
@@ -73,7 +75,11 @@ impl WindowState {
window.unmaximize()?;
}
window.set_size(LogicalSize::new(self.width, self.height))?;
if self.width > util::MIN_WINDOW_SIZE_WIDTH
&& self.height > util::MIN_WINDOW_SIZE_HEIGHT
{
window.set_size(LogicalSize::new(self.width, self.height))?;
}
let pos = PhysicalPosition::new(self.x, self.y);
for monitor in window.available_monitors()? {
+2
View File
@@ -28,6 +28,8 @@ pub static POSSIBLE_TITLES: &[&str] = &[
"never gonna let you down",
"uwu sowwy",
];
pub const MIN_WINDOW_SIZE_WIDTH: f64 = 393.0;
pub const MIN_WINDOW_SIZE_HEIGHT: f64 = 667.0;
shadow!(build);
// Tauri has a way to return the package.json version, but it's not a constant...
+8 -1
View File
@@ -8,13 +8,20 @@ export function TipBox({
children,
hideIcon = false,
whitespace = false,
className,
}: {
children: ReactNode;
hideIcon?: boolean;
whitespace?: boolean;
className?: string;
}) {
return (
<div className="flex flex-row gap-4 bg-accent-background-50 p-4 rounded-md">
<div
className={classNames(
'flex flex-row gap-4 bg-accent-background-50 p-4 rounded-md',
className
)}
>
<div
className={classNames(
'fill-accent-background-20 flex flex-col justify-center',
@@ -13,7 +13,7 @@ import { Recording } from './autobone-steps/Recording';
import { StartRecording } from './autobone-steps/StartRecording';
import { VerifyResultsStep } from './autobone-steps/VerifyResults';
import { useCountdown } from '@/hooks/countdown';
import { CheckHeight } from './autobone-steps/СheckHeight';
import { CheckHeight } from './autobone-steps/CheckHeight';
import { PreparationStep } from './autobone-steps/Preparation';
export function AutomaticProportionsPage() {
@@ -62,7 +62,7 @@ export function AutomaticProportionsPage() {
></StepperSlider>
</div>
</div>
<div className="w-full pb-4 flex flex-grow flex-row mobile:justify-center">
<div className="w-full pb-4 flex flex-row mobile:justify-center">
<Button
variant="secondary"
onClick={startCountdown}
@@ -117,7 +117,7 @@ export function CheckHeight({
'onboarding-automatic_proportions-check_height-fetch_height'
)}
</Button>
<TipBox whitespace={true}>
<TipBox className="break-words">
{l10n.getString(
'onboarding-automatic_proportions-check_height-guardian_tip'
)}
@@ -93,7 +93,7 @@ export function Recording({
)}
</Typography>
</div>
<ol className="list-decimal mobile:px-4">
<ol className="list-decimal mobile:px-4 nsmol:hidden">
<>
{l10n
.getString('onboarding-automatic_proportions-recording-steps')
@@ -44,7 +44,7 @@ export function StartRecording({
return (
<>
<div className="flex flex-col flex-grow">
<div className="flex flex-col flex-grow gap-3">
<div className="flex flex-row flex-grow">
<div className="flex flex-grow flex-col gap-4">
<Typography variant="main-title" bold>
@@ -59,7 +59,7 @@ export function StartRecording({
)}
</Typography>
</div>
<ol className="list-decimal mobile:px-4">
<ol className="list-decimal mobile:px-4 nsmol:hidden">
<>
{l10n
.getString('onboarding-automatic_proportions-recording-steps')
@@ -71,7 +71,7 @@ export function StartRecording({
))}
</>
</ol>
<div className="flex">
<div className="flex nsmol:hidden">
<TipBox>{l10n.getString('tips-do_not_move_heels')}</TipBox>
</div>
</div>
@@ -100,6 +100,9 @@ export function StartRecording({
</button>
</div>
<div className="flex smol:hidden">
<TipBox>{l10n.getString('tips-do_not_move_heels')}</TipBox>
</div>
<div className="flex gap-3 mobile:justify-between">
<Button
variant={variant === 'onboarding' ? 'secondary' : 'tertiary'}
+13 -12
View File
@@ -1,7 +1,7 @@
import plugin from 'tailwindcss/plugin'
import forms from '@tailwindcss/forms'
import gradient from 'tailwind-gradient-mask-image'
import type { Config } from 'tailwindcss'
import plugin from 'tailwindcss/plugin';
import forms from '@tailwindcss/forms';
import gradient from 'tailwind-gradient-mask-image';
import type { Config } from 'tailwindcss';
const colors = {
'blue-gray': {
@@ -156,6 +156,8 @@ const config = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
screens: {
nsmol: { raw: 'not (min-width: 525px)' },
smol: '525px',
mobile: { raw: 'not (min-width: 800px)' },
xs: '800px',
sm: '900px',
@@ -163,7 +165,7 @@ const config = {
'md-max': { raw: 'not (min-width: 1100px)' },
lg: '1300px',
xl: '1600px',
tall: { raw: '(min-height: 800px)'}
tall: { raw: '(min-height: 800px)' },
},
extend: {
colors: {
@@ -229,14 +231,13 @@ const config = {
},
},
data: {
checked: 'checked=true'
}
checked: 'checked=true',
},
},
plugins: [
forms,
gradient,
plugin(function ({ addUtilities }) {
const textConfig = (fontSize: any, fontWeight: any) => ({
fontSize,
fontWeight,
@@ -251,10 +252,10 @@ const config = {
'.text-standard-bold': textConfig('calc(var(--font-size-standard) / 16)', 700),
});
}),
plugin(function({ addVariant }) {
addVariant('checked-hover', ['&:hover', '&[data-checked=true]'])
})
plugin(function ({ addVariant }) {
addVariant('checked-hover', ['&:hover', '&[data-checked=true]']);
}),
],
} satisfies Config
} satisfies Config;
export default config;
@@ -187,6 +187,9 @@ class BVHFileStream : PoseDataStream {
val positionScale = bvhSettings.positionScale
writer
.write("${rootPos.x * positionScale} ${rootPos.y * positionScale} ${rootPos.z * positionScale}")
// Add spacing
writer.write(" ")
writeBoneHierarchyRotation(rootBone, null)
writer.newLine()
@@ -46,7 +46,9 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
emptyList()
}
private val parser = UDPProtocolParser()
private val rcvBuffer = ByteArray(512)
// 1500 is a common network MTU. 1472 is the maximum size of a UDP packet (1500 - 20 for IPv4 header - 8 for UDP header)
private val rcvBuffer = ByteArray(1500 - 20 - 8)
private val bb = ByteBuffer.wrap(rcvBuffer).order(ByteOrder.BIG_ENDIAN)
// Gets initialized in this.run()
@@ -319,6 +321,9 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
tracker.setRotation(rot)
if (packet is UDPPacket23RotationAndAcceleration) {
tracker.setAcceleration(packet.acceleration)
}
tracker.dataTick()
}
@@ -68,8 +68,6 @@ class UDPDevice(
set(manufacturer) {
super.manufacturer = manufacturer
}
override var firmwareVersion: String? = null
get() = field?.let { "v$it" }
fun getTracker(id: Int): Tracker? = trackers[id]
}
@@ -329,6 +329,27 @@ class UDPPacket22FeatureFlags(
}
}
data class UDPPacket23RotationAndAcceleration(
override var rotation: Quaternion = Quaternion.IDENTITY,
var acceleration: Vector3 = Vector3.NULL,
) : UDPPacket(23),
RotationPacket {
override var sensorId: Int = 0
override fun readData(buf: ByteBuffer) {
// s16 s16 s16 s16 s16 s16 s16
// qX qY qZ qW aX aY aZ
sensorId = buf.get().toInt() and 0xFF
val scaleR = 1 / (1 shl 15).toFloat() // Q15: 1 is represented as 0x7FFF and -1 as 0x8000
val x = buf.short * scaleR
val y = buf.short * scaleR
val z = buf.short * scaleR
val w = buf.short * scaleR
rotation = Quaternion(w, x, y, z).unit()
val scaleA = 1 / (1 shl 7).toFloat() // The same as the HID scale
acceleration = Vector3(buf.short * scaleA, buf.short * scaleA, buf.short * scaleA)
}
}
data class UDPPacket200ProtocolChange(
var targetProtocol: Int = 0,
var targetProtocolVersion: Int = 0,
@@ -127,6 +127,7 @@ class UDPProtocolParser {
const val PACKET_TEMPERATURE = 20
const val PACKET_USER_ACTION = 21
const val PACKET_FEATURE_FLAGS = 22
const val PACKET_ROTATION_AND_ACCELERATION = 23
const val PACKET_BUNDLE = 100
const val PACKET_PROTOCOL_CHANGE = 200
private val HANDSHAKE_BUFFER = ByteArray(64)
+1 -1
View File
@@ -59,7 +59,7 @@ dependencies {
implementation("net.java.dev.jna:jna:5.+")
implementation("net.java.dev.jna:jna-platform:5.+")
implementation("com.fazecast:jSerialComm:2.10.2")
implementation("org.hid4java:hid4java:0.7.0")
implementation("org.hid4java:hid4java:0.8.0")
}
tasks.shadowJar {
@@ -91,14 +91,12 @@ abstract class SteamVRBridge(
hasRightFoot && !isRightFootSteamVr,
)
// hasKnees if foot tracker and lower and/or upper leg tracker is on
val hasLeftKnee = hasLeftFoot && skeleton.hasLeftFootTracker
// hasKnees is just hasFeet
val isLeftKneeSteamVr = skeleton.leftUpperLegTracker?.device?.isOpenVrDevice == true
val hasRightKnee = hasRightFoot && skeleton.hasRightFootTracker
val isRightKneeSteamVr = skeleton.rightUpperLegTracker?.device?.isOpenVrDevice == true
changeShareSettings(TrackerRole.LEFT_KNEE, hasLeftKnee && !isLeftKneeSteamVr)
changeShareSettings(TrackerRole.RIGHT_KNEE, hasRightKnee && !isRightKneeSteamVr)
changeShareSettings(TrackerRole.LEFT_KNEE, hasLeftFoot && !isLeftKneeSteamVr)
changeShareSettings(TrackerRole.RIGHT_KNEE, hasRightFoot && !isRightKneeSteamVr)
// hasElbows if an upper arm or a lower arm tracker is on
val hasLeftElbow = skeleton.hasLeftArmTracker
@@ -32,7 +32,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
private val hidServices: HidServices
init {
hidServicesSpecification.isAutoStart = false
hidServicesSpecification.setAutoStart(false)
hidServices = HidManager.getHidServices(hidServicesSpecification)
hidServices.addHidServicesListener(this)
val dataReadThread = Thread(dataReadRunnable)
@@ -43,7 +43,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
private fun checkConfigureDevice(hidDevice: HidDevice) {
if (hidDevice.vendorId == 0x2FE3 && hidDevice.productId == 0x5652) { // TODO: Use correct ids
if (!hidDevice.isOpen) {
if (hidDevice.isClosed) {
check(hidDevice.open()) { "Unable to open device" }
}
// TODO: Configure the device here
@@ -164,7 +164,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
var devicesPresent = false
for ((hidDevice, deviceList) in devicesByHID) {
val dataReceived: Array<Byte> = try {
hidDevice.read(80, 1) // Read up to 80 bytes, timeout 1ms
hidDevice.read(80, 0) // Read up to 80 bytes
} catch (e: NegativeArraySizeException) {
continue // Skip devices with read error (Maybe disconnected)
}
@@ -174,6 +174,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
// TODO: make this less bad
if (dataReceived.size % 20 != 0) {
LogManager.info("[TrackerServer] Malformed HID packet, ignoring")
continue // Don't continue with this data
}
val packetCount = dataReceived.size / 20
var i = 0
@@ -243,6 +244,10 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
// TODO:
}
override fun hidDataReceived(p0: HidServicesEvent?) {
// Seems to have issues with the size of data returned
}
companion object {
/**
* Change between IMU axes and OpenGL/SteamVR axes