Commit a2a62f54 authored by Quirin Apfel's avatar Quirin Apfel
Browse files

iir filter

parent 216bcaed
......@@ -97,15 +97,9 @@ float pid_control(float e)
*/
float offset_control(float motor_signal)
{
const float K = 0.001f;
float max_offset = 4.3;
float min_offset =-4.3f;// 1.0;
/*
if(motor_signal > 10){
motor_signal = 10;
}else if(motor_signal < -10){
motor_signal = -10;
}*/
const float K = 0.001f;//0.001
float max_offset = 6.0;
float min_offset = 0.0;
sum_offset += K*motor_signal/F_CONTROL;
float new_offset = sum_offset;
......
......@@ -31,7 +31,7 @@ static float iir_filter(float phi_acc)
*/
float complementary_filter(float phi_acc, float gyro_rate, uint16_t f_sampling)
{
float k = 0.999;
float k = 0.995;
float phi_acc_fil = iir_filter(phi_acc);
phi_cor = k*(phi_cor+gyro_rate/f_sampling)+(1.0-k)*phi_acc_fil;
return phi_cor;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment