|
@@ -51,7 +51,7 @@ void app_start(void){
|
|
|
|
|
|
|
|
static void app_print_log(void) {
|
|
static void app_print_log(void) {
|
|
|
//sys_debug("Slow: %d - %d, err:%d, %d\n", g_meas_MCTask.intval_time, g_meas_MCTask.exec_time, g_meas_MCTask.exec_max_error_time, g_meas_MCTask.exec_time_error);
|
|
//sys_debug("Slow: %d - %d, err:%d, %d\n", g_meas_MCTask.intval_time, g_meas_MCTask.exec_time, g_meas_MCTask.exec_max_error_time, g_meas_MCTask.exec_time_error);
|
|
|
- //sys_debug("Fast: %d - %d, err: %d-%d-%d\n", g_meas_foc.intval_time, g_meas_foc.exec_time, g_meas_foc.intval_hi_err, g_meas_foc.intval_low_err, g_meas_foc.exec_max_error_time);
|
|
|
|
|
|
|
+ sys_debug("Fast: %d - %d, err: %d-%d-%d\n", g_meas_foc.intval_time, g_meas_foc.exec_time, g_meas_foc.intval_hi_err, g_meas_foc.intval_low_err, g_meas_foc.exec_max_error_time);
|
|
|
//sys_debug("FOC time err %d %d %d %d\n", g_meas_foc.intval_time_h_error, g_meas_foc.intval_time_l_error, g_meas_foc.exec_max_error_time, g_meas_foc.exec_time_error);
|
|
//sys_debug("FOC time err %d %d %d %d\n", g_meas_foc.intval_time_h_error, g_meas_foc.intval_time_l_error, g_meas_foc.exec_max_error_time, g_meas_foc.exec_time_error);
|
|
|
//sys_debug("acc vol %d, bid %d\n", get_acc_vol(), gpio_board_id());
|
|
//sys_debug("acc vol %d, bid %d\n", get_acc_vol(), gpio_board_id());
|
|
|
//sys_debug("throttle %f\n", get_throttle_float());
|
|
//sys_debug("throttle %f\n", get_throttle_float());
|
|
@@ -108,15 +108,20 @@ static u32 app_report_task(void *p) {
|
|
|
}
|
|
}
|
|
|
return 200;
|
|
return 200;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
int plot_type = 0;
|
|
int plot_type = 0;
|
|
|
-static void plot_smo_angle(void) {
|
|
|
|
|
- float smo_angle = foc_observer_sensorless_angle();
|
|
|
|
|
- float delta = smo_angle - foc()->in.mot_angle;
|
|
|
|
|
|
|
+static void plot_sensorless_angle(void) {
|
|
|
|
|
+ float est_angle = foc_observer_sensorless_angle();
|
|
|
|
|
+ if (motor.controller.b_hfi) {
|
|
|
|
|
+ est_angle = motor.controller.hfi.angle_deg;
|
|
|
|
|
+ }
|
|
|
|
|
+ float delta = est_angle - foc()->in.mot_angle;
|
|
|
float s, c;
|
|
float s, c;
|
|
|
arm_sin_cos(delta, &s, &c);
|
|
arm_sin_cos(delta, &s, &c);
|
|
|
delta = fast_atan2(s, c)/PI*180.0f;
|
|
delta = fast_atan2(s, c)/PI*180.0f;
|
|
|
- can_plot3(foc()->in.mot_angle, smo_angle, delta);
|
|
|
|
|
|
|
+ can_plot3(foc()->in.mot_angle, est_angle, delta);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
static u32 app_plot_task(void * args) {
|
|
static u32 app_plot_task(void * args) {
|
|
|
if (plot_type == 1) {
|
|
if (plot_type == 1) {
|
|
|
s16 plot_arg1 = (s16)foc_observer_sensorless_speed();
|
|
s16 plot_arg1 = (s16)foc_observer_sensorless_speed();
|
|
@@ -130,9 +135,9 @@ static u32 app_plot_task(void * args) {
|
|
|
}
|
|
}
|
|
|
can_plot2(plot_arg1, plot_arg2);
|
|
can_plot2(plot_arg1, plot_arg2);
|
|
|
}else if (plot_type == 2) {
|
|
}else if (plot_type == 2) {
|
|
|
- can_plot2(mot_contrl_get_final_torque(&motor.controller), mot_contrl()->target_torque);
|
|
|
|
|
|
|
+ can_plot2(mot_contrl_get_final_torque(&motor.controller), (s16)motor.controller.hfi.vel_integrator);
|
|
|
}else if (plot_type == 3) {
|
|
}else if (plot_type == 3) {
|
|
|
- plot_smo_angle();
|
|
|
|
|
|
|
+ plot_sensorless_angle();
|
|
|
}else if (plot_type == 4) {
|
|
}else if (plot_type == 4) {
|
|
|
can_plot2((s16)foc()->out.curr_dq.d, (s16)foc()->out.curr_dq.q);
|
|
can_plot2((s16)foc()->out.curr_dq.d, (s16)foc()->out.curr_dq.q);
|
|
|
}else if (plot_type == 5) {
|
|
}else if (plot_type == 5) {
|