feat(FOC): 添加齿槽转矩补偿功能
- 实现齿槽转矩补偿算法,通过查表+线性插值方式计算补偿电压值 - 添加齿槽转矩校准功能,支持正转3次+反转3次的非阻塞校准状态机 - 在所有控制模式中集成齿槽转矩补偿,包括开环、角度、速度、电流和MIT模式 - 硬编码预校准的正反转补偿表数据 - 通过CAN命令支持运行时触发校准功能 - 添加相关配置参数和调试开关
This commit is contained in:
@@ -1153,6 +1153,12 @@ void CAN_transmiter::communication_check() {
|
||||
Angle_kalman.init(0); // 角度滤波
|
||||
Vel_kalman.init(0); // 角度滤波
|
||||
}
|
||||
// 齿槽转矩校准 (first_byte bit4) — DEBUG,平时不启用
|
||||
#if FOC_DEBUG
|
||||
if (first_byte >> 4 & 0x01) {
|
||||
FOC.cogging_calib_request = true;
|
||||
}
|
||||
#endif
|
||||
// 休眠
|
||||
if (eigth_byte & 0x80 >> 7) {
|
||||
app_prepare_deep_sleep(true);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "adc.h"
|
||||
#include "config.h"
|
||||
#include <cstdio>
|
||||
|
||||
// TEST 调试宏定义
|
||||
#if TEST_DEBUG
|
||||
#define TEST_DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define TEST_DEBUG_PRINT(fmt, ...) ((void)0)
|
||||
#endif
|
||||
|
||||
constexpr int status_print = 0;
|
||||
extern sampler sampler;
|
||||
void test_1111() {
|
||||
// 初始化 CAN 回环测试
|
||||
// can_loopback_init();
|
||||
// can_config();
|
||||
if (status_print) {
|
||||
/* value print */
|
||||
TEST_DEBUG_PRINT(" the temperature data is %2.2f degrees Celsius\r\n",
|
||||
sampler.get_mcu_temp());
|
||||
TEST_DEBUG_PRINT(" the drv_temperature data is %2.2f degrees Celsius\r\n",
|
||||
sampler.get_drv_temp());
|
||||
TEST_DEBUG_PRINT(" the U current data is %2.2f mA\r\n", sampler.get_current('U'));
|
||||
TEST_DEBUG_PRINT(" the V current data is %2.2f mA\r\n", sampler.get_current('V'));
|
||||
TEST_DEBUG_PRINT(" the W current data is %2.2f mA\r\n", sampler.get_current('W'));
|
||||
TEST_DEBUG_PRINT(" the VBUS is %2.2f V\r\n", sampler.get_vbus_voltage());
|
||||
// TEST_DEBUG_PRINT(" the angle is %2.2f\r\n", tle5012b_read());
|
||||
|
||||
TEST_DEBUG_PRINT("\n----------------------------------------------------\n");
|
||||
}
|
||||
// can_loopback_test();
|
||||
}
|
||||
Reference in New Issue
Block a user