def enable_port(): port_num = dynamixel.portHandler(DEVICENAME) # Open port if dynamixel.openPort(port_num): print("[] Succeeded to open the port!") else: print("[-] Failed to open the port!") quit() # Set port baudrate if dynamixel.setBaudRate(port_num, BAUDRATE): print("[] Succeeded to change the baudrate!") else: print("[-] Failed to change the baudrate!") quit() return True
elif dxl_error != 0: if constants.ENABLE_DXL_MESSAGES: print(dynamixel.getRxPacketError(PROTOCOL_VERSION, dxl_error)) ''' if __name__ == '__main__': # Open port if dynamixel.openPort(port_num): if constants.ENABLE_DXL_MESSAGES: print("[] Succeeded to open the port!") else: if constants.ENABLE_DXL_MESSAGES: print("[-] Failed to open the port!") quit() # Set port baudrate if dynamixel.setBaudRate(port_num, BAUDRATE): if constants.ENABLE_DXL_MESSAGES: print("[] Succeeded to change the baudrate!") else: if constants.ENABLE_DXL_MESSAGES: print("[-] Failed to change the baudrate!") quit() try: botid = input("Enter Bot Id: ") disable_bot(botid) #enable_bot(botid) # enable_bot(4) # enable_bot(6) #set_speed(botid,200) while True: # theta1 = input("Enter Theta1 value: ")