I tried the command:
start_liveplotter(lambda: [odrv0.axis0.encoder.pos_estimate])
from within the interactive odrivetool instance as per the instructions here.
However, this throws the error:
Connected to ODrive 3653385F3030 as odrv0
In [1]: start_liveplotter(lambda: [odrv0.axis0.encoder.pos_estimate])
Out[1]: <fibre.utils.Event at 0x7fa37503e460>
/usr/local/lib/python3.8/dist-packages/odrive/utils.py:176: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
fig = plt.figure()
In [2]: WARNING: QApplication was not created in the main() thread.
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/odrive/utils.py", line 184, in plot_data
fig.canvas.start_event_loop(1/plot_rate)
File "/usr/local/lib/python3.8/dist-packages/matplotlib/backends/backend_qt.py", line 408, in start_event_loop
with _maybe_allow_interrupt(event_loop):
File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.8/dist-packages/matplotlib/backends/qt_compat.py", line 226, in _maybe_allow_interrupt
old_wakeup_fd = signal.set_wakeup_fd(wsock.fileno())
ValueError: set_wakeup_fd only works in main thread
This seems to suggest that it is a matplotlib error that occurs when its functions are called from outside the main thread. Am I using this command incorrectly? Would really appreciate if someone could explain why I get this error since from the documentation it seems like this should just run?
I am using ODrive v3.6 - 56V; Firmware version: 0.5.4
Thank you.