SimpleFOC GUI Configuration/ Tunning tool

+1 from me. I’ll be giving this a try, too! You are a lot further than me with my node/vue tool.

Are you open to collaboration?

1 Like

De lujo !!! @David_Gonzalez

Do not hesitate to ask if you have any questions or find any problem using the application … it is an initial version and it may have some bug.

I know your project. When I started the project, the first thing I did was look for projects similar to what I wanted to achieve that already existed in order to learn from them and see what functionalities each offered. This is the list I made I made. Some of them are full opensorce, some partially and some are poorly documented

What I pretend to do is a “mix” between O-Tres, Dragor and Betzdrive. Use a STM32 as MCU, SimpleFOC for the software, and CAN to make the external control interface as well as adding an IMU which I think may be interesting for later uses of the controller. … I am just starting.

2 Likes

In fact I saw the part of the OSC example but I don’t have much knowledge of that language and I decided to take the idea and make a GUI in Python that I know a little bit more :slight_smile: OSC look very interesting … if i am not wrong you could use your SimpleFOC device move a lasers in a amuses related application :slight_smile:

Yes, totally open @Owen_Williams

In fact, my idea is to evolve this tool to a node / vaule tool, since it is friendlier when you have multiple nodes and it is more flexible when you want to make modifications on the parameters to configure in each node.

I pretend to develop a PCB to make a simpl FOC based controller with CAN interface and to be able to connect each controller to the computer to configure and sending motion commands.

This is an idea of what I intend to achieve where module (1) is the network explorer and node configurator, module (2) is a command line interface module (3) is the display area of variable graphs.

Captura de pantalla 2021-01-18 a las 1.48.45

Instead of adding a tab for each SimpleFOC node it will be possible to add tabs to create other tools that take advantage of the existing configuration functionality, so anyone can create its own tool meeting their requeieriments. It is a modular and extensible tool.

2 Likes

A tool like this would be a great help for people like me! Thanks Jorge

1 Like

@JorgeMaker - I’ve a few problems installing your tool on Ubuntu 20.04 and python 3.7.5.

Initially:

pip install -r requirements.txt
    ERROR: Command errored out with exit status 1:
     command: /home/williao/.pyenv/versions/3.7.5/bin/python3.7 /home/williao/.pyenv/versions/3.7.5/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpq63va3bm

This was fixed with:

pip install --upgrade pip setuptools

I then ran:

williao@williao-G3-3579:~/dev/python/SimpleFOCStudio$ python simpleFOCStudio.py
Traceback (most recent call last):
  File "simpleFOCStudio.py", line 8, in <module>
    from gui.mainWindow import UserInteractionMainWindow
ModuleNotFoundError: No module named 'gui'

So I tried:
export PYTHONPATH=$PWD/src
which then gave:

williao@williao-G3-3579:~/dev/python/SimpleFOCStudio$ python simpleFOCStudio.py
Traceback (most recent call last):
  File "simpleFOCStudio.py", line 8, in <module>
    from gui.mainWindow import UserInteractionMainWindow
  File "/home/williao/dev/python/SimpleFOCStudio/src/gui/mainWindow.py", line 5, in <module>
    from gui.devicesTabbedWidget import DevicesTabbedWidget
  File "/home/williao/dev/python/SimpleFOCStudio/src/gui/devicesTabbedWidget.py", line 5, in <module>
    from gui.deviceConfigTool import DeviceConfigurationWidget
  File "/home/williao/dev/python/SimpleFOCStudio/src/gui/deviceConfigTool.py", line 6, in <module>
    from gui.generalSettingsWidget import GeneralSettingsGroupBox
  File "/home/williao/dev/python/SimpleFOCStudio/src/gui/generalSettingsWidget.py", line 4, in <module>
    from sharedcomponets import ConfigQLineEdit
ModuleNotFoundError: No module named 'sharedcomponets'

I again changed the PYTHONPATH again
export PYTHONPATH=$PWD/src:$PYTHONPATH/src/gui

But that didn’t work. I suspect I’m on the wrong path (pun intended!). Any suggestions?

1 Like

I’m not sure, it seems like Python has some trouble trying to find the different files. I didn’t realize that since I had never run the application from the command line interface, always using PyCham. … let me do my research to see how to fix the problem.

PD: As workarround you add run it from PyCharm or any other Ide adding gui folder as “folder with aources”

I’m having the exact same issue running from atom with Script package.

Hi @David_Gonzalez @Owen_Williams

Hi, I have done a workaround that solved the problem by moving all the files to the same folder. It is not the most elegant solution but it should work after running: python simpleFocStudio.py

Let me know if this solves the issue :slight_smile:

I made a worarraond https://tinyurl.com/y4ul9psf

EDIT: Fixed, it should work without problems as it is in the repository.

That’s better. I got some plots out of it.
image
The UI looks well thought out.

It runs a bit hot on my i7 at faster baud rates but, to be fair, so does platformio serial monitor (which is also python).

The only thing I could set was target. All other ‘sets’ ended up with a response of Target: 0 which suggests the value sent was changed to 0 somehow.

Hi @Owen_Williams

In theory using buttons you can set each parameter and using command line interface you can send any command as if you where typing on the serial console. i just run a test to verify it and it seems to work for meGrabación de pantalla 2021-01-20 a las 22.33.33

This version is working perfectly for me :slight_smile: Awesome tool!

Two observations though:
Default bit rate is set to 11520 instead of 115200. Couldn’t find why it wouldn’t work until I saw this :stuck_out_tongue:

Would be nice to see more than two decimal places, sometimes I set my P to 0.002 or less.

Edit: forgot to mention, had an issue with my windows machine, but I found the fix here: This Windows version (6.3.9600) does not support the required bluetooth API. · GIS4WRF/gis4wrf (github.com).

Hi @David_Gonzalez

Nice to hear the you like it :slight_smile: The limitation on the number os decimals comes from SimpleFOC library I do not trim the nunber of decimals neither when sending or receiving , I just take the string and sent it via serial port to the device. I guess that the limitation comes from here:

Captura de pantalla 2021-01-21 a las 3.26.06

It could be easy solved adding a new monitoring function with a an extra parameter, something like this:

void FOCMotor::useMonitoring(Print &print, int numerOfDecimals);

… but this is out of the scope of my application.

1 Like

Hey @JorgeMaker,
This is a great tool, I did not have time to thank you yet. :smiley:
We have already looked into developing a tool like this and you have made our life a lot easier now!

I will resolve this issue of decimal point for the next release, its noted in my todos. Basically print function receives the number of decimal points already.

monitoring_port->print(value, 4); // for 4 decimal places

I would actually like to advise you not to use the monitoring function motor.monitor() but to use the motor commands using commands V1, V2 and V3. It is async but then you can decide your own sampling rate and more time for the motor to do its focing :smiley:
But downsampling works well as well!

Also for the next release I’ll introduce the “verbose” option to the motor commands so that we can avoid the textual outputs.

Finally, based on your interest on node/value interface for simplefoc I have some ideas and I think it would be interesting to discuss more thoroughly in the new thread. Let me create it and explain my vision for the simplefoc and I would love to hear what you think.

Cheers!

1 Like

Hi @Antun_Skuric

The only dependency that I have assumed is what the motor.monitor() function returns through the serial port, which I consider as an external interface. Great, go ahead and create a new thread :slight_smile:

no luck running it with Mac OS

import serial
ModuleNotFoundError: No module named ‘serial’

try doing from the console:

pip install pyserial

Hi @JorgeMaker,
Would be it possible to do worked this HMI under MACOSX, and how ? It seems there is an issue with pyQt5…

Thank you in advance.

I went further, but even after to have installed “pip install pyserial”, it replies

import serial

ModuleNotFoundError: No module named ‘serial’

However, I got from console:
Requirement already satisfied: pyserial in /usr/local/lib/python3.7/site-packages (3.5)

Hi @Marc_O,

The tool should work perfectly on MacOS, since in addition to being developed with Python, I made it with my MacBook.

If you describe to me what problem you have with PyQt5, I can try to figure out what is happening.

A couple of days ago I was able to create a SimpleFOCStudio.App to use the tool in MacOS without needing Python installed on your computer. It is not in the repository yet as I am hoping to be able to create the Windows app and add them simultaneously.

On my computer it works perfectly but has not been tested in any other computer. Let me know it works for you.

regards