med-material / vrtactility

🤏 Exploring electro-tactile stimulation in Virtual Reality
Apache License 2.0
1 stars 1 forks source link

Making first contact with the stimulator always requires a second attempt to succeed #10

Closed kuff closed 1 year ago

kuff commented 1 year ago

When you start the app in the CalibrationScene, type in the correct port number and click connect, the connection attempt always fails the first attempt after the stimulator has been started. This means the app must be restarted to make another attempt at a connection, which then succeeds. After this, the app can be restarted and a new connection can be made every time until the stimulator is turned off and on again, after which two attempts are again needed to establish a connect the first time.

This may be because the stimulator (or Ardity) for some reason only accepts a reconnection attempt, instead of a new connection attempt. This has been occurring ever since the port to Ardity. The no-questions-asked solution to this would be to just programmatically make two connection attempts every time the app starts, deliberately ignoring the first attempt. There should exist a more elegant fix to this, and it might be a simple oversight on my part, but I need to investigate further to confirm.

Once I'm able, I'll expand on this issue with the console logs from Unity....

MartinGarenfeld commented 1 year ago

A permanent fix could likely be closing all identified valid serial ports as the first thing when the app starts, before establishing connection with the stimulator. I think we also talked about this at a meeting sometime, but it seemed like there was not a straightforward solution on how to implement this. But I assume it should be possible.

kuff commented 1 year ago

Entire console output for first connection attempt:

image

Entire second console output from second (successful) connection attempt:

image

On the surface, this doesn't tell us a lot other than there being a series of erroneous connection attempts in the first attempt, which are not present in the second one.

A permanent fix could likely be closing all identified valid serial ports as the first thing when the app starts, before establishing connection with the stimulator. I think we also talked about this at a meeting sometime, but it seemed like there was not a straightforward solution on how to implement this. But I assume it should be possible.

Will definitely try this.

kuff commented 1 year ago

Fixed as of https://github.com/med-material/vrtactility/commit/4ae90dd843720c9dadbb4c95c2082b1da9966c00.