chenged to 2 motor velocity-closed-loop; before testing

This commit is contained in:
2025-11-20 09:50:13 +08:00
parent dd8f7c006f
commit ed09f10c03
13 changed files with 276 additions and 261 deletions

View File

@@ -1,20 +1,35 @@
#ifndef __DFOC_H
#define __DFOC_H
struct Motor_ {
int Mot_num;
float Ua;
float Ub;
float Uc;
float Ubeta;
float Ualpha;
float dc_a;
float dc_b;
float dc_c;
};
void Motor_en(void);
float constrain(float amt, float low, float high);
void SetPwm(float Ua, float Ub, float Uc);
void SetPwm(int Mot_num, float Ua, float Ub, float Uc);
float normalizeAngle(float angle);
void SetPhaseVoltage(float Uq, float Ud, float angle_el);
void SetPhaseVoltage(struct Motor_ *Motor, float Uq, float angle_el);
float cal_Iq_Id(float current_a, float current_b, float angle_el);
void Check_Sensor(void);
void FOC_Init(float power);
float electricAngle(void);
float GetCommand(void);
void Set_Angle(float Target);
void FOC_Init(void);
float M0_electricAngle(void);
float M1_electricAngle(void);
void M0_Set_Angle(float Target);
void M0_Set_Velocity(float Target);
void M0_Set_CurTorque(float Target);
void M1_Set_Angle(float Target);
void M1_Set_Velocity(float Target);
void M1_Set_CurTorque(float Target);
float velocityopenloop(float target);
void Print_Velocity(int Motor_Velocity);
#endif