You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
# 1. Get Controller and Headset Poses
|
|
|
|
import xrobotoolkit_sdk as xrt
|
|
|
|
xrt.init()
|
|
|
|
left_pose = xrt.get_left_controller_pose()
|
|
right_pose = xrt.get_right_controller_pose()
|
|
headset_pose = xrt.get_headset_pose()
|
|
|
|
print(f"Left Controller Pose: {left_pose}")
|
|
print(f"Right Controller Pose: {right_pose}")
|
|
print(f"Headset Pose: {headset_pose}")
|
|
|
|
|
|
# 2. Get Controller Inputs (Triggers, Grips, Buttons, Axes)**
|
|
|
|
|
|
|
|
# Triggers and Grips
|
|
left_trigger = xrt.get_left_trigger()
|
|
right_grip = xrt.get_right_grip()
|
|
print(f"Left Trigger: {left_trigger}, Right Grip: {right_grip}")
|
|
|
|
# Buttons
|
|
a_button_pressed = xrt.get_A_button()
|
|
x_button_pressed = xrt.get_X_button()
|
|
print(f"A Button Pressed: {a_button_pressed}, X Button Pressed: {x_button_pressed}")
|
|
|
|
# Axes
|
|
left_axis = xrt.get_left_axis()
|
|
right_axis_click = xrt.get_right_axis_click()
|
|
print(f"Left Axis: {left_axis}, Right Axis Clicked: {right_axis_click}")
|
|
|
|
# Timestamp
|
|
timestamp = xrt.get_time_stamp_ns()
|
|
print(f"Current Timestamp (ns): {timestamp}")
|
|
|
|
|
|
# 3. Get hand tracking state
|
|
|
|
# Left Hand State
|
|
left_hand_tracking_state = xrt.get_left_hand_tracking_state()
|
|
print(f"Left Hand State: {left_hand_tracking_state}")
|
|
# Right Hand State
|
|
right_hand_tracking_state = xrt.get_right_hand_tracking_state()
|
|
print(f"Right Hand State: {right_hand_tracking_state}")
|