111

Dependencies:   yezhong_main_controller_copy mbed1-dev

CONTROL/control.cpp

Committer:
ganlikun
Date:
2022-07-09
Revision:
10:f83b0935a8f0
Parent:
0:d80c66cb1b3a

File content as of revision 10:f83b0935a8f0:

#include "control.h"


void control()
{
    if(command_control_flag == 1)
        command_control();
    
    if(return_zero == 1)
    {
//        gangduceshi();
    }
         
    if(c_lock == 1)                                                             // 处于PC串口锁定模式
    {
//        cal_command.q_des_pf  = SP_pf;
//        cal_command.qd_des_pf = 0.0f;
//        cal_command.kp_pf     = 200.0f;
//        cal_command.kd_pf     = 0.0f;
//        cal_command.tau_pf_ff = 0.0f;
//        
//        cal_command.q_des_df  = SP_df;
//        cal_command.qd_des_df = 0.0f;
//        cal_command.kp_df     = 200.0f;
//        cal_command.kd_df     = 0.0f;
//        cal_command.tau_df_ff = 0.0f;
    }
    
    if(c_lock == 0)
    {
        //calculate_pf_kh();
//        calculate_pf_fuzzy();
        
        //calculate_df();
    }
    
    // 将计算得到的数值赋给控制器
    
//    a_control.pf.p_des = cal_command.q_des_pf;
//    a_control.pf.v_des = cal_command.qd_des_pf;
//    a_control.pf.kp    = cal_command.kp_pf / 7.0f;
//    a_control.pf.kd    = cal_command.kd_pf / 7.0f;
//    a_control.pf.t_ff  = cal_command.tau_pf_ff / 7.0f;
//        
//    a_control.df.p_des = cal_command.q_des_df;
//    a_control.df.v_des = cal_command.qd_des_df;
//    a_control.df.kp    = cal_command.kp_df / 10.0f;
//    a_control.df.kd    = cal_command.kd_df / 10.0f;
//    a_control.df.t_ff  = cal_command.tau_df_ff / 10.0f;
    
}