ea493af11f
- Delete attitude_t struct from ins_task.h - INS_Init() returns INS_t* directly instead of casting from INS.Gyro offset - Change Gimbal_Upload_Data_s.gimbal_imu_data to INS_t* pointer - Update gimbal.c and robot_cmd.c accordingly
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
#ifndef MOTOR_DEF_H
|
|
#define MOTOR_DEF_H
|
|
|
|
#include "controller.h"
|
|
#include "stdint.h"
|
|
#include "bsp_can.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
|