diff --git a/Code/triad_openvr/tracker_test.py b/Code/triad_openvr/tracker_test.py index bac3d50..0d3b2ff 100644 --- a/Code/triad_openvr/tracker_test.py +++ b/Code/triad_openvr/tracker_test.py @@ -17,10 +17,14 @@ if interval: while(True): start = time.time() txt = "" - for each in v.devices["hmd_1"].get_pose_euler(): - txt += "%.4f" % each - txt += " " - print("\r" + txt, end="") - sleep_time = interval-(time.time()-start) - if sleep_time>0: - time.sleep(sleep_time) \ No newline at end of file + pose_euler = v.devices["hmd_1"].get_pose_euler() + if pose_euler is not None: + for each in pose_euler: + txt += "%.4f" % each + txt += " " + print("\r" + txt, end="") + sleep_time = interval - (time.time() - start) + if sleep_time > 0: + time.sleep(sleep_time) + else: + print("定位器超出基站扫描视野范围!") \ No newline at end of file