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

Investigate and potentially improve timing stability of vibrations #13

Open
jbphet opened this issue May 23, 2022 · 2 comments
Open

Investigate and potentially improve timing stability of vibrations #13

jbphet opened this issue May 23, 2022 · 2 comments
Assignees

Comments

@jbphet
Copy link
Contributor

jbphet commented May 23, 2022

While doing some prototyping of haptic vibration for phetsims/quadrilateral#104, I felt like the vibration wasn't very steady in some cases when dragging elements of the sim. I suspect that this is because the vibrations are currently timed by stepping the vibrationManager, so if the animation frames aren't keeping up, the vibrations will be unsteady. One of the designers on the project reported the same experience.

We should first figure out a way to make some measurements so we can determine if the problem really exists and isn't some perceptual thing, and then can also test and measure solutions to quantify if we've really improved things.

@jbphet jbphet self-assigned this May 23, 2022
@jbphet
Copy link
Contributor Author

jbphet commented Jun 6, 2022

As a first attempt to get some measurements of the accuracy of the haptic vibrations, I set up my Samsung S7 on a table with it tilted up slightly by being propped on a scaled ruler, and butting up against some clamps, with a microphone to record the vibration. It looked like this:

vibration-test-setup

I recorded the sounds produced by the various interactions that produce vibrations, then looked at the recordings in Audacity (a free sound-editing app). Below is a 1.5-second sample of the vibration produced when dragging a vertex (i.e. a corner) in the quadrilateral sim, which is currently coded to produce a pattern of 75ms on and 75ms off. Note that there is a "missing beat" at around 14.45 seconds, which is probably what makes it feel a bit unsteady. By the way, it is a stereo recording, which is why two channels are shown.

image

There were a number of such unsteady sections in the recording. Here are 20 seconds of the 75-ms-on-75-ms-off pattern, and it shows a number of small gaps. This is at a different time scale than the first recording shown above.

image

Next is a screenshot that shows the resulting sound from dragging a side, which is 200ms on and 200ms off. This is 1.5 seconds long.

image

This pattern is more steady than the first, but also shows that it takes a while (on the order of 50 to 100 ms) for the motor to ramp up, and about the same amount of time to damp out. Also, in the 200-ms-on-200-ms-off pattern, there is a bit of a dip in amplitude in each pulse for some as yet unknown reason. I am not personally sensing this in the haptic vibration, but it shows up in the audio recording.

I thought it would be useful to see how long it takes for the motor to ramp up for a long pulse, so I used the Haptics Playground app to produce a 1 second pulse. Below is what that sounded/looked like. Note that it takes on the order of 400 ms to really get fully stable, and even then it tapers a bit before reaching what appears to be a full steady state.

image

My next step will be to change the code to see if I can make the faster pattern steadier. However, after looking at this data, I'm concerned that we may be running into the physical limitations of the vibration hardware for this particular device, so we might not be able to make it much better.

jbphet added a commit to phetsims/quadrilateral that referenced this issue Jun 9, 2022
@jbphet
Copy link
Contributor Author

jbphet commented Aug 2, 2022

Based on the Q3 planning, work on haptics for the Quadrilateral sim is being de-prioritized for a while. I'm going to defer this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant