diff --git a/modules/motor/DMmotor/dmmotor.c b/modules/motor/DMmotor/dmmotor.c index 81f4ed1..ebb9efb 100644 --- a/modules/motor/DMmotor/dmmotor.c +++ b/modules/motor/DMmotor/dmmotor.c @@ -188,7 +188,7 @@ DMMotorInstance *DMMotorInit(DM_Motor_Init_Config_s *config) void DMMotorSetRef(DMMotorInstance *motor, float ref) { - motor->pid_ref = ref; + motor->motor_controller.pid_ref = ref; } void DMMotorSetCtrlMode(DMMotorInstance *motor, DM_Motor_Mode_e mode) @@ -218,7 +218,7 @@ void DMMotorControl(void) /* angle PID: IMU feedback → velocity output */ float pid_ref = PIDCalculate(&motor->motor_controller.angle_PID, *motor->motor_controller.other_angle_feedback_ptr, - motor->pid_ref); + motor->motor_controller.pid_ref); if (motor->output_reverse == OUTPUT_DIRECTION_REVERSE) pid_ref *= -1; diff --git a/modules/motor/DMmotor/dmmotor.h b/modules/motor/DMmotor/dmmotor.h index d6e2223..cfa2bac 100644 --- a/modules/motor/DMmotor/dmmotor.h +++ b/modules/motor/DMmotor/dmmotor.h @@ -57,7 +57,6 @@ typedef struct float mit_kp; // MIT mode KP (motor internal position gain, 0~500) float mit_kd; // MIT mode KD (motor internal velocity gain, 0~5) - float pid_ref; // reference input from application } DMMotorInstance; /* DM motor init config */