Change division to multiplication in floating point operation
This commit is contained in:
parent
9f0d81cc76
commit
3b2d8c14c3
@ -29,7 +29,7 @@ void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p,
|
|||||||
pid->k_p = k_p;
|
pid->k_p = k_p;
|
||||||
pid->k_int = k_int;
|
pid->k_int = k_int;
|
||||||
pid->k_deriv = k_deriv;
|
pid->k_deriv = k_deriv;
|
||||||
pid->k_int_t = pid->k_int * pid->sample_period / 2.0f;
|
pid->k_int_t = pid->k_int * pid->sample_period * 0.5f;
|
||||||
pid->k_deriv_t = pid->k_deriv * 2.0f / pid->sample_period;
|
pid->k_deriv_t = pid->k_deriv * 2.0f / pid->sample_period;
|
||||||
pid->output_sat_max = output_sat_max;
|
pid->output_sat_max = output_sat_max;
|
||||||
pid->output_sat_min = output_sat_min;
|
pid->output_sat_min = output_sat_min;
|
||||||
|
Loading…
Reference in New Issue
Block a user