优化手柄控制

This commit is contained in:
2025-12-10 11:46:28 +08:00
parent 450383cabb
commit 39d860c7ee
3 changed files with 35 additions and 28 deletions

22
test.py
View File

@@ -1,10 +1,18 @@
import time
from Robotic_Arm.rm_robot_interface import *
import pygame
if __name__=="__main__":
rmarm = RoboticArm(rm_thread_mode_e.RM_DUAL_MODE_E)
rmarm.rm_create_robot_arm("192.168.3.18", 8080)
rmarm.rm_set_arm_run_mode(0)
pygame.init()
pygame.joystick.init()
joystick = pygame.joystick.Joystick(0)
print(joystick.get_name())
while True:
ret = rmarm.rm_get_arm_software_info()
print(ret)
time.sleep(1)
pygame.event.wait()
a={
"leftx":joystick.get_axis(0),
"lefty":joystick.get_axis(1),
"rightx":joystick.get_axis(2),
"righty":joystick.get_axis(3),
"left_bj":joystick.get_axis(4),
"right_bj":joystick.get_axis(5),
}
print(a)