odrive.utils
- class odrive.utils.BulkCapture(get_var_callback, data_rate=500.0, duration=2.0)
Asynchronously captures a bulk set of data when instance is created.
get_var_callback: a function that returns the data you want to collect (see the example below) data_rate: Rate in hz length: Length of time to capture in seconds
- Example Usage:
capture = BulkCapture(lambda :[odrv0.axis0.encoder.pos_estimate, odrv0.axis0.controller.pos_setpoint]) # Do stuff while capturing (like sending position commands) capture.event.wait() # When you’re done doing stuff, wait for the capture to be completed. print(capture.data) # Do stuff with the data capture.plot_data() # Helper method to plot the data
- exception odrive.utils.OperationAbortedException
- odrive.utils.dump_errors(odrv, clear=False)
Prints a summary of the error status of the device on stdout.
- odrive.utils.format_errors(odrv, clear=False)
Returns a summary of the error status of the device as RichText.
- odrive.utils.fw_version_str_to_tuple(version_string)
Converts a version string to a tuple of the form (major, minor, revision, prerelease)
Example: “fw-v0.3.6-23” => (0, 3, 6, True)
If version_string does not match the pattern above, this function throws an Exception.
- odrive.utils.print_drv_regs(name, motor)
Dumps the current gate driver regisers for the specified motor
- async odrive.utils.ram_osci_run(odrv, expressions, trigger_point=0.0)
Configures the RAM oscilloscope with the specified expressions, optionally triggers it and waits for it to finish before downloading the data.
- trigger_point: A number in [0.0, 1.0] or None.
If None, it is expected that a custom trigger in firmware is used after configuring the osci.
- odrive.utils.rate_test(device)
Tests how many integers per second can be transmitted
- odrive.utils.start_liveplotter(get_var_callback: Callable, legend: List[str] = None)
Starts a liveplotter. The variable that is plotted is retrieved from get_var_callback. This function returns immediately and the liveplotter quits when the user closes it.
- odrive.utils.usb_burn_in_test(get_var_callback, cancellation_token)
Starts background threads that read a values form the USB device in a spin-loop