- Notifications
You must be signed in to change notification settings - Fork24
GUAIK-ORG/CawFOC
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Github:https://github.com/GUAIK-ORG/CawFOC
Gitee:https://gitee.com/GuaikOrg/CawFOC
CAW FOC 项目由 3 部分组成,在 CAW-PACKAGES/ControlSystem/FOC 目录下存放相关的代码。
- foc.h/foc.c:foc 相关的主要算法
- foc_hal.h/foc_hal.c:用于配置编码器
- foc_test.h/foc_test.c:测试程序
https://www.bilibili.com/video/BV1Hh4y1M7nH/
https://www.bilibili.com/video/BV1BP411v7nA/
功能 | 状态 |
---|---|
开环速度控制 | ✔ |
闭环力矩控制 | ✔ |
闭环位置控制 | ✔ |
闭环速度控制 | ✔ |
Windows
下载 arm-none-eabi-gcc
设置环境变量
将
gcc-arm-none-eabi\bin
的绝对路径添加进系统变量的 Path 中
Mac
brew tap ArmMbed/homebrew-formulaebrew install arm-none-eabi-gcc
切换到项目根目录然后运行:mingw32-make
,即可在项目根目录中的 build 目录中找到编译生成的文件[CawFOC.elf | CawFOC.bin | CawFOC.hex]。
一下代码可以在freertos.c
中查看
FOC_Tfoc1;PID_TvelPID1;PID_TanglePID1;LOWPASS_FILTER_TvelFilter1;FOC_Closeloop_Init(&foc1,&htim1,PWM_PERIOD,12.6,1,7);FOC_SetVoltageLimit(&foc1,10.0);FOC_HAL_Init(&foc1,&hi2c1);PID_Init(&velPID1,2,0,0,100000,foc1.voltage_power_supply /2);PID_Init(&anglePID1,2,0,0,100000,100);LOWPASS_FILTER_Init(&velFilter1,0.01);FOC_AlignmentSensor(&foc1);for (;;) {// 闭环位置控制// Foc_TestCloseloopAngle(&foc1, &anglePID1, 3.141592654);// 闭环速度控制Foc_TestCloseloopVelocity(&foc1,&velFilter1,&velPID1,10);FOC_SensorUpdate();osDelay(1);}
Park 变换:https://zhuanlan.zhihu.com/p/614244367
Clark 变换:https://zhuanlan.zhihu.com/p/613996592
DengFoc:http://dengfoc.com/#/
SimpleFOC 中文:http://simplefoc.cn/#/