Skip to content

Commit

Permalink
Merge pull request #467 from NicksonYap/lh_fix_get_bs_pos
Browse files Browse the repository at this point in the history
get_bs_position - fix decode("utf-8")
  • Loading branch information
krichardsson authored Sep 10, 2019
2 parents a4bf399 + d3bee1a commit 941162d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tools/lighthouse/get_bs_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

CENTER_AROUND_CONTROLLER = False

print("Openning OpenVR")
print("Opening OpenVR")
vr = openvr.init(openvr.VRApplication_Other)

print("OpenVR Oppened")
print("OpenVR Opened")
devices = {}
poses = vr.getDeviceToAbsoluteTrackingPose(openvr.TrackingUniverseStanding, 0,
openvr.k_unMaxTrackedDeviceCount)
Expand Down Expand Up @@ -49,7 +49,14 @@
if poses[i].bPoseIsValid:
device_class = vr.getTrackedDeviceClass(i)
if (device_class == openvr.TrackedDeviceClass_TrackingReference):
mode = vr.getStringTrackedDeviceProperty(i, openvr.Prop_ModeLabel_String).decode("utf-8")

mode = vr.getStringTrackedDeviceProperty(i, openvr.Prop_ModeLabel_String)
try:
mode = mode.decode("utf-8")
except:
#likely already decoded
pass

pose = poses[i].mDeviceToAbsoluteTracking

# Mode 'B' is master
Expand Down

0 comments on commit 941162d

Please sign in to comment.