jangxx / VRC-Tracked-Objects

A system to read tracking data and feed it into VRChat via OSC
MIT License
50 stars 2 forks source link

Doesn't seem to track position #1

Closed Gosha closed 2 years ago

Gosha commented 2 years ago

I'm not sure if I'm doing anything wrong, but it doesn't seem like any of the /avatar/parameters/OscTrackedPos{X,Y,Z} parameters are sent to vrchat. The box on my hand rotates when I rotate either my hand or the tracker. But it's always stuck to the wrist.

I calibrated with only one controller and one tracker connected, so I'm pretty sure I got that right.

Moving the puppet controls does move the box as expected.

Sorry about the shakiness, but here's a video.

jangxx commented 2 years ago

Mhm, that looks really strange, I really don't see how it could be possible that no positional data is sent while the rotational part seemingly works. Although, even the rotation looks a bit weird in that video. Does it really mirror the rotation of the tracker properly? It looks like it was just spinning around.

The only thing I could think of right now is that the calibration is probably wrong somehow. Can you post your config file or just a screenshot of the calibration view?

Oh and another tip: don't touch the analog stick while trying to use the tracking. I've seen some really weird bugs happen when you input parameters that are also controlled via OSC. Mostly that the OSC data just get's discarded and it looks like everything is broken. Closing and reopening the menu fixes it though.

Gosha commented 2 years ago

Oh, actually that's another thing. The config gets saved really weird:

{
  "Autostart": false,
  "OscInputAddress": "127.0.0.1:9001",
  "OscOutputAddress": "127.0.0.1:9000",
  "ControllerSerial": "LHR-23626CBF",
  "TrackerSerial": "LHR-98CED565",
  "Avatars": {
    "avtr_d78a5be1-ac67-4f93-8cdc-ad2921eca74e": {
      "Name": "Naoko2",
      "Parameters": {
        "Activate": "/avatar/parameters/OSCTrackingEnabled",
        "PositionX": "/avatar/parameters/OscTrackedPosX",
        "PositionY": "/avatar/parameters/OscTrackedPosY",
        "PositionZ": "/avatar/parameters/OscTrackedPosZ",
        "RotationX": "/avatar/parameters/OscTrackedRotX",
        "RotationY": "/avatar/parameters/OscTrackedRotY",
        "RotationZ": "/avatar/parameters/OscTrackedRotZ"
      },
      "Calibration": {
        "Scale": 12099998,
        "TranslationX": 3,
        "TranslationY": 5,
        "TranslationZ": 15,
        "RotationX": 14899989,
        "RotationY": 4270003,
        "RotationZ": 18199986
      }
    }
  }
}

Those aren't even close to the low values I saw when I was calibrating.

I wouldn't say it's mirroring the rotation as expected. But at least it seems to be rotating approximately the same amount as the tracker.

These were the values I had when calibrating: image

Gosha commented 2 years ago

Those are probably pretty important, so I'm guessing that's the cause for it not working. Just looking at it, I expect it's a locale-related error. Notice that my values have commas in them as decimal places. While the ones I see in your YouTube video have a dot as the decimal separator.

I confirmed that it does work if I edit the .json file and put in the numbers from the calibration.

jangxx commented 2 years ago

Yep I agree with you, the values in the config file are wrong and this seems like an obvious locale error. I'll check the C# docs again to see why this happened. I was under the impression that the conversion from float -> string and string -> float would use the same locale so that it's bidirectional. I guess my assumption was wrong then, lol.

I confirmed that it does work if I edit the .json file and put in the numbers from the calibration.

Does that mean that everything is working perfectly if you only change the calibration values? Because in that case it should be a rather simple fix on my end.

jangxx commented 2 years ago

Oh and also, if you have more problems with the rotations, I would suggest you try the calibration again and try to keep all (absolute) values below Pi. From a maths point of view it shouldn't matter if you put in 4.270003 or -2.013182, but I can't guarantee that my code handles this correctly since I haven't explicitly tested it.

Gosha commented 2 years ago

Does that mean that everything is working perfectly if you only change the calibration values? Because in that case it should be a rather simple fix on my end.

Yeah, works perfectly with:

{
  "Scale": 1.2099998,
  "TranslationX": 0.03,
  "TranslationY": 0.05,
  "TranslationZ": 0.15,
  "RotationX": 1.4899989,
  "RotationY": 4.270003,
  "RotationZ": 1.8199986
}

video

jangxx commented 2 years ago

Very nice and also funny to see that you also use it for drink tracking :D Now all that's missing is a contact sender that sends a Bottle tag and we we could virtually clink our real-life bottles together. If you'd be down for that you can add me in VRChat, my username is the same as on here.

Besides that I'll take a look into the locale thing ASAP, thanks for reporting it.

jangxx commented 2 years ago

Fixed in version 0.1.1.