优化手柄控制
This commit is contained in:
22
test.py
22
test.py
@@ -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)
|
||||
Reference in New Issue
Block a user