ODrive GUI Beta Release

@PJohnson I have tested the GUI yesterday, and noticed some issues with the python server and some python (flask, flask socketio) dependencies.
Eventually I got it running.
Do you want me to make a pull request?

Sure, what issues were you seeing? Did you install those dependencies with pip before running the GUI?

Yes I installed all dependencies, when I use npm run electron:serve everything is working, when building with npm run electron:build and I try to run the app, it can’t find flask.

import flask ModuleNotFoundError: No module named 'flask'

Basically OSX has a standard python3 installed. In the past I have installed different versions of python with pyenv. For some reason when running the build electron app its using /usr/bin/python3 although when I use python3 or pip it is using the pyenv installed version. I even tried /usr/bin/pip3 to install those dependencies but it returns errors.
Seems like a problem with python on my machine.

To get it running with npm run electron:serve I only changed the last line of odrive_server.py from socketio.run(app, host='0.0.0.0', port=5000) to socketio.run(app, port=5000)

Interesting, I have never heard of that! The host='0.0.0.0' part is a result of a problem I had in windows (but not linux) - for some reason, ‘0.0.0.0’ is a much faster localhost connection than ‘127.0.0.1’. I can add an OS check for that line.

Hmm. Possibly, it is making use of a hardware buffer on your Ethernet card. Which may have mixed results, perhaps? :thinking:
Beware that setting host='0.0.0.0' in python (probably node.js too) normally means listen on all interfaces not just localhost. So anyone else on your network can connect to your ODrive.

1 Like

Hi! I have cloned the git repo just now, and built the GUI from source (in the devel branch), using ‘npm run electron:serve’. I get this WARN in the command line, and the GUI opens up, but the GUI shows an JS error message in a Dialog Box. If I click it away, the GUI can’t find my drives. I am using Ubuntu 20.04, ODrivetool 0.5.1, Python3.

Anyone knows what’s wrong?
Cheers,

Dan

Here is the JS Error Message that is shown in GUI:

That’s a strange error. I think what’s happening is this: the GUI server needs python3. Depending on the OS you use, the command to launch python3 is either python3 or python. The GUI checks this by looking at the output of python -V. Depending on the platform and python version, that output is on either stdout or stderr. Those checks use the toString() method, so if it returns null then something has gone wrong with how I’m checking for the command to launch python3.

What output do you get in a terminal if you run python -V? I’m on ubuntu 18.04 because I had some issues with the snap ecosystem in ubuntu 20.04, but I can get a live session going and see if the error is replicable in general.

Thanks for your help! When I enter ‘python -V’, I get an error:
python -V

Command ‘python’ not found, did you mean:

command ‘python3’ from deb python3
command ‘python’ from deb python-is-python3

Any ideas?

Looks to me like you don’t have python installed! You should be able to install it with sudo apt install python3.

Python3 has already been installed:

root@sol:/home/dan# apt show python3
APT-Manual-Installed: yes
Version: 3.8.2-0ubuntu2

dan@sol:~$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)

When I run ‘python3 -V’ it works:
python3 -V
Python 3.8.5

But when I run ‘python -V’ it does not work!:

python -V

Command ‘python’ not found, did you mean:

command ‘python3’ from deb python3
command ‘python’ from deb python-is-python3

On windows, I always use the python launcher. It’s the most reliable way:

py -3 -v

Everything else is a crapshoot lol. We actually do a dumb check in tup to see what the user has available, by running python -v then python3 -v and seeing which one comes back positive (if either)

Nice work on the GUI, much easier than the command line…
I have a setup of 12 ODrives and need to configure all of them. If I switch USB to a new ODrive the GUI gets an error:


return self.handle_event(handler, message, namespace, sid, File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\flask_socketio_init.py", line 713, in _handle_event
ret = handler(*args)
File “C:\Users\xxx\AppData\Local\Temp\1iURP9zHSnPIwQqaYQtYdKhKfbW\resources\server\odrive_server.py”, line 119, in get_odrives
odriveDict[key] = dictFromRO(globals()[‘odrives’][key])
File “C:\Users\xxx\AppData\Local\Temp\1iURP9zHSnPIwQqaYQtYdKhKfbW\resources\server\odrive_server.py”, line 170, in dictFromRO
returnDict[key] = {“val”: str(RO._remote_attributes[key].get_value()), File “C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\fibre\remote_object.py”, line 72, in get_value
buffer = self._parent.channel.remote_endpoint_operation(self._id, None, True, self._codec.get_length()) File “C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\fibre\protocol.py”, line 314, in remote_endpoint_operation
raise ChannelBrokenException() # Too many resend attempts fibre.protocol.ChannelBrokenException


If i disconnect an ODrive and connect the same I get no error. So the issue is only with a new one.
Closing the GUI.exe (windows) is not enough as i need to kill the Python process also in order to connect to a new ODrive.

Can you try to build the GUI from devel? I think this was fixed on Windows.

Which version of Windows are you using? The ODrive disconnect/reconnect will be fixed, but I am unable to replicate the dangling python process issue on Windows 10. In fact, I don’t see a python process launched at all with the GUI, it’s all rolled into “ODriveGUI.exe” in task manager. This might be from some specifics of my system. Thank you for the bug report!

I used the compiled exe, downloaded 2 days ago.
I get the same if i run the build. from the output terminal (anaconda) i get this:


lost odrive
lost odrive
Found 206639884D4D
odrive list: [‘odrive0’, ‘odrive1’]
Exception in thread Thread-834:
Traceback (most recent call last):
File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\threading.py”, line 917, in _bootstrap_inner
self.run()
File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\threading.py”, line 865, in run
self._target(*self._args, **self._kwargs)
File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\socketio\server.py”, line 682, in _handle_event_internal


And from the debug output from the application I get this:


lost odrive
lost odrive
Found 206639884D4D odrive list: [‘odrive0’, ‘odrive1’]
Exception in thread Thread-834: Traceback (most recent call last): File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\threading.py”, line 917, in _bootstrap_inner self.run() File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\threading.py”, line 865, in run self._target(*self._args, **self._kwargs) File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\socketio\server.py”, line 682, in _handle_event_internal r = server._trigger_event(data[0], namespace, sid, *data[1:]) File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\socketio\server.py”, line 711, in trigger_event return self.handlers[namespace]event File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\flask_socketio_init.py", line 283, in handler *args) File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\flask_socketio_init.py", line 713, in _handle_event ret = handler(*args) File “C:\Users\xxx\OneDrive - SINTEF\Ocean\Projects\BLDC\ODrive\git\ODrive-gui-0.0.1-beta1\GUI\server\odrive_server.py”, line 119, in get_odrives odriveDict[key] = dictFromRO(globals()[‘odrives’][key]) File “C:\Users\xxx\OneDrive - SINTEF\Ocean\Projects\BLDC\ODrive\git\ODrive-gui-0.0.1-beta1\GUI\server\odrive_server.py”, line 170, in dictFromRO returnDict[key] = {“val”: str(RO._remote_attributes[key].get_value()), File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\fibre\remote_object.py”, line 72, in get_value buffer = self._parent.channel.remote_endpoint_operation(self._id, None, True, self._codec.get_length()) File “C:\Users\xxx\AppData\Local\Continuum\anaconda3\lib\site-packages\fibre\protocol.py”, line 315, in remote_endpoint_operation raise ChannelBrokenException() # Too many resend attempts fibre.protocol.ChannelBrokenException


Im running with FW 0.5.1 RC5 (if that matters).
Is there a disconnect button? I just unplug the ODrive and reconnects a new one when this happens.

On the devel branch of the ODrive repo, this issue is fixed. Can you pull the repo and launch it from there and see if it fixes your issue?

In general, if you are disconnecting and reconnecting ODrives often, I strongly recommend to fully close the GUI and reopen it. The USB backend (shared by the GUI and odrivetool) currently works for that but has some issues - there are changes on the way to fix that, but that is not within the scope of the GUI. In other words, the GUI won’t crash, but if you disconnect and reconnect 10 different ODrives, strange things might happen.

1 Like

For some reason I was not cloning the devel branch, but I am now. When I run the GUI from ‘npm run electron:serve’ it connects and disconnects properly. But the values are not updating, they turn into NAN when i connect Odrive1 (the bar is green and it says connected). If I reconnect to ODrive0 the values show up again.

If I build the application I get this error message:


args from python:
Traceback (most recent call last): File “C:\Users\xxx\AppData\Local\Temp\1jPZR7l2DHLJKgutzaY3qlopb7x\resources\server\odrive_server.py”, line 260, in
import odrive ModuleNotFoundError: No module named ‘odrive’


I can start the odrive server by running ‘python3 odrive_server.py’ from anaconda. If i do the motor is connected in the exe-file (but I get NaN if i connect a new one…)

Edit: Running the last command from anaconda, not python…

Is there away to use the GUI with an ODrive connected over UART?