How to use the odrive.usbbulk.poll_odrive_bulk_device function in odrive

To help you get started, we’ve selected a few odrive examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github madcowswe / ODrive / tools / test_communication.py View on Github external
def main(args):
  global running
  print("ODrive USB Bulk Communications")
  print("---------------------------------------------------------------------")
  print("USAGE:")
  print("\tPOSITION_CONTROL:\n\t\tp MOTOR_NUMBER POSITION VELOCITY CURRENT")
  print("\tVELOCITY_CONTROL:\n\t\tv MOTOR_NUMBER VELOCITY CURRENT")
  print("\tCURRENT_CONTROL:\n\t\tc MOTOR_NUMBER CURRENT")
  print("\tHALT:\n\t\th")
  print("\tQuit Python Script:\n\t\tq")
  print("---------------------------------------------------------------------")
  # query device
  dev = usbbulk.poll_odrive_bulk_device(printer=print)
  print (dev.info())
  print (dev.init())
  # thread
  thread = threading.Thread(target=receive_thread, args=[dev])
  thread.start()
  while running:
    time.sleep(0.1)
    try:
      command = input("\r\nEnter ODrive command:\n")
      if 'q' in command:
        running = False
        sys.exit()
      else:
        dev.send(command)
    except:
      running = False