3 Star 10 Fork 18

ream_d / SimpleFOCStudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

SimpleFOCStudio

Graphical user interface for the SimpleFOClibrary. This application allows to tune and configure any BLDC/Stepper SimpleFOClibrary controlled device, using serial port communications and the Commander interface.

The main features are:

  • Plug and play with the SimpleFOClibrary version 2.1
  • Real-time tuning and configuration of the motors
  • Real-time plotting and monitoring of motor variables
  • Code generation for easier integration of the tuned parameters in your code
  • Built on PyQt5 and a standardized SimpleFOCConnector interface that can be used as a gateway form python to the SimpleFOClibrary device.

Installation

Don't worry, SimpleFOCStudio is easy to install even if you have never used the terminal before! 😃 There are just couple of steps to take:

  1. Install Python if you don't have it installed yet
    • We suggest to use Anaconda. Here is how to install it.
    • Once you have your Anaconda running open your terminal (on windows anaconda prompt) and run:
    conda create -n simplefoc python=3.6.0
    • Once this is done you will never have to run that command again, from now on you will just need:
    conda activate simplefoc
  2. Clone this repository or download the zip file
  3. Enter the folder containing the repository using the terminal
    • the command will be something like this:
    cd  some_path_on_disk/SimpleFOCStudio
  4. Final step of the installation is installing all the necessary libraries for the SimpleFOCStudio :
    pip install -r "requirements.txt"

Once you have done all the steps above you do not need to repeat them any more. All you need to do the next time is open your terminal in the SimpleFOCStudio directory and run the command:

python simpleFOCStudio.py

Or if using Anaconda:

conda activate simplefoc
python simpleFOCStudio.py

Usage

SimpleFOCStudio has several useful features:

  • A simple approach to tuning your motor setup
    • Form view for fast motion control PID/LPF tuning
    • TreeView for more in depth tunning and experimenting
  • Code generation for transferring the found parameters into your arduino code
  • Serial terminal integrated with various commander features

Motion control tunning windows

Once you have your application running add a device by clicking the motor button in the toolbar. You can choose either the TreeView or the FormView.

  • To connect to your device first configure the serial port by clicking on Configure button
  • Add your com port info and click OK
  • Then add the device command ID that you've added to the commander usually its M
    • Command M , Arduino code : command.add('M',doMotor,"my motor")
    • Command A , Arduino code : command.add('A',doMotor,"my motor")
  • Then click to the Connect button and you should be ready to go!

Code generation

SimpleFOCStudio helps you to easier transfer your carefully tuned parameters to the Arduino code. Once you are happy with the performance of your system you can automatically generate the arduino code of the parameters you have tuned. To generate the code :

  • Click on the Arudino button in the toolbar.
  • Choose which sets of parameters you wish to generate the code for and click OK
  • In the new tab you will have a code of your tuned parameters.

The generated code you can just copy/paste in your setup() function, just before calling the motor.init()

Custom Commands

You can create your own custom commands if you extend the Commnader interface in your sketch. This can be used for example to do things like change register settings for SPI devicesor any oyher functionality. Each custom command has a name and a value as you can see at the below image.

Once you have added each custom command in order to execute it you just need to select it and once selected press the space key (⎵) or right arrow key (→).

Integrated serial terminal

SimpleFOCStudio also has integrated serial terminal for easier debugging and monitoring.

Arduino code

Basically there are two things you need to do:

  1. Use the commander interface and add the motor to the commander
  2. Use the monitoring and add the motor.monitor() in the loop

Here is a mockup of the code:

#include <SimpleFOC.h>

....

// include commander interface
Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup(){
  ....
  // add the motor to the commander interface
  // The letter (here 'M') you will provide to the SimpleFOCStudio
  command.add('M',doMotor,'motor');
  // tell the motor to use the monitoring
  motor.useMonitoring(Serial);
  motor.monitor_downsample = 0; // disable monitor at first - optional
  ...

}
void loop(){
  ....

  ....
  // real-time monitoring calls
  motor.monitor();
  // real-time commander calls
  command.run();
}
MIT License Copyright (c) 2021 JorgeMaker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

SimpleFOC Studio 国内镜像 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/ream_d/SimpleFOCStudio.git
git@gitee.com:ream_d/SimpleFOCStudio.git
ream_d
SimpleFOCStudio
SimpleFOCStudio
main

搜索帮助