Skip to content
Snippets Groups Projects
Commit 1a6ba71a authored by dawehr's avatar dawehr
Browse files

Adjustments to LiDAR complementary filter.

parent 447f7cfc
No related branches found
No related tags found
No related merge requests found
......@@ -125,14 +125,14 @@ int sensor_processing(log_t* log_struct, user_input_t *user_input_struct, raw_se
/*
* Altitude double complementary filter
*/
static float alt_alpha = 0.9975;
static float alt_alpha = 0.98;
static float filtered_vel = 0;
static float filtered_alt = 0;
static float last_lidar = 0;
float this_lidar = raw_sensor_struct->lidar_distance_m;
float this_lidar = -raw_sensor_struct->lidar_distance_m;
// Acceleration in m/s without gravity
float quad_z_accel = -9.8 * (accel_z + 1);
float quad_z_accel = 9.8 * (accel_z + 1);
filtered_vel = alt_alpha*(filtered_vel + quad_z_accel*get_last_loop_time()) +
(1 - alt_alpha)*(this_lidar - last_lidar);
filtered_alt = alt_alpha*(filtered_alt + filtered_vel*get_last_loop_time()) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment