# Pygame init import sys, pygame pygame.init() screen = pygame.display.set_mode((400, 300)) # Arm init sys.path = ['./lib'] + sys.path from robot_arm import * arm = robot_arm() #Main event loop done = False while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True if event.type == pygame.KEYDOWN: # Base if event.key == pygame.K_LEFT: arm.move_arm(BASE_COUNTERCLOCKWISE) if event.key == pygame.K_RIGHT: arm.move_arm(BASE_CLOCKWISE) # Shoulder if event.key == pygame.K_UP: arm.move_arm(SHOULDER_UP)
MMMMMimport sys sys.path = [ './lib' ] + sys.path from robot_arm import * arm = robot_arm ( ) arm.move_arm_timed(ELBOW_UP,4) arm.move_arm_timed(GRIP_OPEN,2) arm.move_arm_timed(BASE_CLOCKWISE,1) arm.move_arm_timed(SHOULDER_DOWN,3) arm.move_arm_timed(WRIST_UP,1)