#!/usr/bin/python # ROBOT ARM CONTROL PROGRAM Template (with hints) # # Programming For Testers Workshop BTD 2014 # Phill Isles, Graham Thomas - 2014 # ### identifies hints #INITIALISATION # Import the USB and Time libraries into Python import usb.core, usb.util, time # Allocate the name 'RoboArm' to the USB device RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x0000) # Check if the arm is detected and warn if not if RoboArm is None: raise ValueError("Arm not found") print "Arm Present" ### Do not amend code before this point ### Amend code below ### You will need a viable to control the loop # Shoulder ### while loop 7 tiems RoboArm.ctrl_transfer(0x40,6,0x100,0,[128, 0, 0],1000) # Move shoulder up time.sleep(0.5) # Time for movement RoboArm.ctrl_transfer(0x40,6,0x100,0,[0,0,0],1000) # Stop movement time.sleep(1) # Pause arm before next command # Elbow ### while Loop 5 times RoboArm.ctrl_transfer(0x40,6,0x100,0,[16, 0, 0],1000) # Move Elbow Down time.sleep(0.5) # Time for movement RoboArm.ctrl_transfer(0x40,6,0x100,0,[0,0,0],1000) # Stop movement time.sleep(1) # Pause arm before next command # Gripper ### Do once RoboArm.ctrl_transfer(0x40,6,0x100,0,[2, 0, 0],1000) # Open Gripper Jaws time.sleep(0.5) # Time for Movement RoboArm.ctrl_transfer(0x40,6,0x100,0,[0,0,0],1000) # Stop movement time.sleep(1) # Pause arm before next command ### input prompt ask if target hit ### If check target hit and print success