from PopPyControl.poppy import Poppy import time robot = Poppy() delay = 1 delayStart = 0.5 for id, motor in robot.motors.items(): motor.update() motor.setTorque(1) print('Algoritmo Equilibrio') try: # Posicao 01 print('Posicao Inicial') # Pernas robot.l_ankle.setPosition(1733) robot.r_ankle.setPosition(2018) time.sleep(delayStart) robot.l_knee.setPosition(1941) robot.r_knee.setPosition(1950) time.sleep(delayStart) robot.l_hip_y.setPosition(2151) robot.r_hip_y.setPosition(2163) time.sleep(delayStart) robot.l_hip_z.setPosition(2118) robot.r_hip_z.setPosition(2117) time.sleep(delayStart) robot.l_hip_x.setPosition(2100) robot.r_hip_x.setPosition(1840)
prevStep = step print(f"Passo {step} movendo {motorID} para {angle}") elif algorithmType == 2: motorID = int(line[0]) angle = int(line[1]) delay = int(line[2]) print(f"Passo {step} movendo {motorID} para {angle}") time.sleep(delay) step += 1 algorithm.close() if not isLoop: break except KeyboardInterrupt: print("\nAlgoritmo Abortado.") if __name__ == "__main__": robot = Poppy() while True: try: algorithmName = str(input("Digite o algoritmo desejado: ")) except KeyboardInterrupt: # robot.close() print('\n') break readAlgorithm("robot", algorithmName)
from PopPyControl.poppy import Poppy import time robot = Poppy() for id, motor in robot.motors.items(): motor.setLED(1) time.sleep(1) for id, motor in robot.motors.items(): motor.setLED(0) robot.clear() robot.close()
from PopPyControl.poppy import Poppy import time robot = Poppy() delay = 1 for id, motor in robot.motors.items(): motor.update() motor.setTorque(1) print('Algoritmo Acenar') try: # Posicao 1 print('Posicao 1') robot.l_ankle.setPosition(1752) robot.r_ankle.setPosition(2070) time.sleep(delay) robot.l_knee.setPosition(979) robot.r_knee.setPosition(987) time.sleep(delay) robot.l_hip_y.setPosition(1155) robot.r_hip_y.setPosition(3150) time.sleep(delay) robot.l_hip_z.setPosition(2167) robot.r_hip_z.setPosition(2008) time.sleep(delay) robot.l_hip_x.setPosition(2135) robot.r_hip_x.setPosition(1848) time.sleep(delay)