67a26a5ff6
- Remove DJImotor, HTmotor, LKmotor, step_motor, servo_motor directories - Remove Motor_Control_Setting_s and related enums (Closeloop_Type_e, Feedback_Source_e, Feedfoward_Type_e, MOTOR_SEND_MODE_e, Motor_Working_Type_e) - Merge motor_reverse_flag and feedback_reverse_flag into output_reverse - Hardcode DM motor control: IMU angle feedback → angle PID → velocity output - Simplify Motor_Init_Config_s to only: PID params, output_reverse, motor_type, CAN config
57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
#ifndef MOTOR_DEF_H
|
|
#define MOTOR_DEF_H
|
|
|
|
#include "controller.h"
|
|
#include "stdint.h"
|
|
|
|
#define LIMIT_MIN_MAX(x, min, max) (x) = (((x) <= (min)) ? (min) : (((x) >= (max)) ? (max) : (x)))
|
|
|
|
/* 输出反向标志 */
|
|
typedef enum
|
|
{
|
|
OUTPUT_DIRECTION_NORMAL = 0,
|
|
OUTPUT_DIRECTION_REVERSE = 1,
|
|
} Output_Reverse_Flag_e;
|
|
|
|
/* 电机类型枚举 */
|
|
typedef enum
|
|
{
|
|
MOTOR_TYPE_NONE = 0,
|
|
DM_MOTOR,
|
|
} Motor_Type_e;
|
|
|
|
/* 电机控制器: PID 实例和外部反馈指针 */
|
|
typedef struct
|
|
{
|
|
float *other_angle_feedback_ptr; // 外部角度反馈指针 (如 IMU)
|
|
float *other_speed_feedback_ptr; // 外部速度反馈指针 (如 IMU 陀螺仪)
|
|
|
|
PIDInstance angle_PID;
|
|
PIDInstance speed_PID;
|
|
PIDInstance current_PID;
|
|
|
|
float pid_ref;
|
|
} Motor_Controller_s;
|
|
|
|
/* 电机控制器初始化配置 */
|
|
typedef struct
|
|
{
|
|
float *other_angle_feedback_ptr;
|
|
float *other_speed_feedback_ptr;
|
|
|
|
PID_Init_Config_s angle_PID;
|
|
PID_Init_Config_s speed_PID;
|
|
PID_Init_Config_s current_PID;
|
|
} Motor_Controller_Init_s;
|
|
|
|
/* CAN 电机通用初始化结构体 */
|
|
typedef struct
|
|
{
|
|
Motor_Controller_Init_s controller_param_init_config;
|
|
Output_Reverse_Flag_e output_reverse;
|
|
Motor_Type_e motor_type;
|
|
CAN_Init_Config_s can_init_config;
|
|
} Motor_Init_Config_s;
|
|
|
|
#endif // MOTOR_DEF_H
|