Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

K2API: (2) Roles

公彦赤屋先 edited this page Aug 30, 2021 · 1 revision

Trackers' roles enumeration for OpenVR

Trackers' roles in OpenVR are presenting like this:
(At least those in general, not in OpenVR API,
those are like vive_tracker_ then role in lowercase)

  • "TrackerRole_Handed"
  • "TrackerRole_LeftFoot"
  • "TrackerRole_RightFoot"
  • "TrackerRole_LeftShoulder"
  • "TrackerRole_RightShoulder"
  • "TrackerRole_LeftElbow"
  • "TrackerRole_RightElbow"
  • "TrackerRole_LeftKnee"
  • "TrackerRole_RightKnee"
  • "TrackerRole_Waist"
  • "TrackerRole_Chest"
  • "TrackerRole_Camera"
  • "TrackerRole_Keyboard"

When you're updating the tracker's data or creating a new tracker object,
this will be available to set in role property.
You can select one role from KinectToVR_API.h, ktvr::ITrackerType enum.
ktvr::ITrackerType_String is wrapping roles to OpenVR API used type, described upper.

Due to current API construction (and probably OpenVR), you cannot change the tracker's role
or serial after adding it to OpenVR's device list, that is - activating it /
setting its state to true for the first time.
In wiki examples we're using role ktvr::Tracker_LeftFoot, but actually it could be anything you want,
of course anything we want it to be, as long as it is described in the ktvr::ITrackerType enum.

Declaration of this enum is located at https://github.com/KinectToVR/k2vr-application/blob/master/KinectToVR_API/KinectToVR_API.h#L135
after setting this up, it's used in the server at https://github.com/KinectToVR/k2vr-application/blob/master/driver_KinectToVR/K2Tracker.cpp#L246
for generating the tracker name, and at https://github.com/KinectToVR/k2vr-application/blob/master/driver_KinectToVR/K2Tracker.cpp#L261
for setting its role in SteamVR trackers menu.