fix(FOC): 修复角度控制中的冗余CAN传输与传感器角度获取错误

- 修正速度控制中角度传感器数据读取错误,使用current_sensorangle替代getRawAngle
- 在Timer中断中统一使用angle_control进行角度闭环控制
- 完善角度传感器类的角度读取逻辑,增加current_angle_deg和current_angle_rad成员变量
- 添加getcurrent_sensorangle接口用于获取当前原始角度值
This commit is contained in:
cbb
2025-11-08 21:04:35 +08:00
parent 99cc397931
commit b33574d392
5 changed files with 31 additions and 18 deletions
+4 -1
View File
@@ -23,12 +23,15 @@ class angle_sensor {
float getRawAngle(void) const;
float getVelocity(void) const;
float getRawVelocity(void) const;
float getcurrent_sensorangle(void) const;
protected:
void KTH7823_init(void);
float m_cumulativeAngle;
float current_angle_deg;
float current_angle_rad;
bool m_firstUpdate;
float m_lastAngle;
float m_cumulativeAngle;
float m_lastcumulativeAngle;
float velocity[VEL_FILTER_SIZE] = {0.0f};
};