SlimeVR-Server icon indicating copy to clipboard operation
SlimeVR-Server copied to clipboard

Fix acceleration axis and leg tweaks

Open 9il opened this issue 1 year ago • 14 comments

Fixes #1006

This PR fixes the axis for leg tweaks! However, an additional update of thresholds may be required.

@ImUrX, please test it in standard mode with leg tweaks like skating correction.

I don't have slimes for testing.

image

9il avatar Apr 29 '24 20:04 9il

This won't affect skating-correction since the magnitude of acceleration is not being changed.

Not really. Some code uses only the two components, like Vector3(footDif.x, 0f, footDif.z) . It uses x and z components, which correspond to trackers to original (x y) components in this PR and trackers (y z) in the current main branch. z in the tracker coordinates corresponds to the gravity direction. That is what the fix is about.

	private fun correctUnlockedFootTracker(footPosition: Vector3, previousFootPosition: Vector3, previousFootPositionCorrected: Vector3, footVelocity: Vector3, framesUnlocked: Int): Vector3 {
		var newFootPosition = footPosition
		var footDif = footPosition - previousFootPositionCorrected
		footDif = Vector3(footDif.x, 0f, footDif.z)

9il avatar May 09 '24 19:05 9il

This won't affect skating-correction since the magnitude of acceleration is not being changed.

Not really. Some code uses only the two components, like Vector3(footDif.x, 0f, footDif.z) . It uses x and z components, which correspond to trackers to original (x y) components in this PR and trackers (y z) in the current main branch. z in the tracker coordinates corresponds to the gravity direction. That is what the fix is about.

	private fun correctUnlockedFootTracker(footPosition: Vector3, previousFootPosition: Vector3, previousFootPositionCorrected: Vector3, footVelocity: Vector3, framesUnlocked: Int): Vector3 {
		var newFootPosition = footPosition
		var footDif = footPosition - previousFootPositionCorrected
		footDif = Vector3(footDif.x, 0f, footDif.z)

That is a positional correction, the acceleration is not used like that, I just checked. Mocap mode does use the acceleration direction though so this will help that!

Stermere avatar May 09 '24 20:05 Stermere

@ImUrX is anything else required for this PR to be merged?

9il avatar May 18 '24 16:05 9il

You need to wait for more reviewers

ImUrX avatar May 18 '24 17:05 ImUrX

I though that two reviwers are enough. Should we ping someone to make a review?

9il avatar May 18 '24 17:05 9il

@Stermere id don't know if the fusion does the order right, but, at least, they in the right order during packet formation.

If you like I could take the original AXES_OFFSET and apply it both to rotation and acceleration. So, it will be defined by mostly by software, not a math.

On the other hand, if the bug is in the fustion, than the firmware has to be fixed instead of tuning the server for the firmware. At least, we could define a new version of protocol. The reason is because slime wants to be a kind of opensource standard for VR.

The current acceleratoin offsets is defenetely wrong. Some code may work better now because it was tuned for the current wrong offsets. That could work for now but it can be so for a robust code evolution.

9il avatar May 22 '24 15:05 9il

We should check firmware for all main IMUs and make sure that it sends acceleration in the same axises, I guess.

Eirenliel avatar Mar 04 '25 17:03 Eirenliel

@Eirenliel We don't use the Slime firmware and I am not sure to fix it. I believe the bug is both in leg tweaking and in firmware in the way they are cancel each other in one way or another. The reason is that the software evolved with the firmware bug present. On the other hand, the bug constraint further progress in leg tweaking and etc because people work with stuff that doesn't really mean what it says it means. So the software evolves according to Darwin laws instead of common sense and math.

Can we merge this PR before the firmware fix? I can rebase it and simplify it by explicitly applied the same transformation like for rotation.

9il avatar Mar 05 '25 12:03 9il

both bugs may be on the server side as well.

9il avatar Mar 05 '25 12:03 9il

@9il I am interested in testing this, I had a friend do some research into it. Where is this github at that contains this fix? Or has this already been fixed and the issue is not closed?

Shade-emry avatar Mar 27 '25 15:03 Shade-emry

Hi @Shade-emry, there are currently other issues as mentioned which should be resolved first.

sctanf avatar Mar 27 '25 15:03 sctanf

Hi folks. I can update this PR if you confirm it that nothing else is blocking it. We don' use slime firmware, and can't fix it (if it is requires fix which is not clear).

9il avatar Mar 27 '25 18:03 9il

This fix loos correct. We should confirm that it doesn't break legtweaks, @Stermere @ButterscotchV and we can merge it after 0.14.0 release

Eirenliel avatar Mar 27 '25 21:03 Eirenliel

rebased

9il avatar Mar 30 '25 12:03 9il