Closing liveplotter crashes odrivetool


Dont know if i’m not using liveplotter right, or if it’s a bug in odrivetool

I would typically plot set_points with usb/odrivetool while pushing set_points through UART.
(tested on windows 10, dont know if it’s important or not)

(venv) ~\Documents\Sheitan\venv> odrivetool
ODrive control utility v0.4.9
Please connect your ODrive.
You can also type help() or quit().

Connected to ODrive 3773366D3137 as odrv0

In [4]: cancellation_token = start_liveplotter(lambda: [odrv0.axis0.controller.pos_setpoint, odrv0.axis1.controller.pos
   ...: _setpoint] )

Then i observe data being plotted, it seems about right, then i click the ‘X’ icon on the top right corner of the windows to close it. (the intent then is to plot something else)

and then eventually after a few seconds not doing anything else I observe

In [5]: Tcl_Asy: async handler deleted by the wrong threadException ignored in: <bound method Image.__del__ of <tkinter.
PhotoImage object at 0x000001BB6EEEFD68>>

Traceback (most recent call last):
  File "c:\users\bastien.ferbu\appdata\local\programs\python\python36\Lib\tkinter\", line 3507, in __del__'image', 'delete',
RuntimeError: main thread is not in main loop
In [5]:
(venv) ~\Documents\Sheitan\venv>

Is this a bug or am i supposed to issue a command in odrivetool to close the liveplotter instead of using the X icon?

Well, that’s weird because closing the window should trigger an event to stop the plotter.

But I think that you can type cancellation_token.set() to manually trigger that event. Or perhaps CTRL+C in the terminal also works. I am currently not able to try it myself, but I hope that solves the issue!