22 hal.
console->
printf(
"ArduPilot LowPassFilter test ver 1.0\n\n");
35 low_pass_filter.
reset(0);
37 for(int16_t i = 0; i < 300; i++ ) {
40 const float new_value = sinf((
float)i * 2 *
M_PI * 5 / 50.0
f);
46 const float filtered_value = low_pass_filter.
apply(new_value, 0.02
f);
49 hal.
console->
printf(
"\toutput: %6.4f\n", (
double)filtered_value);
AP_HAL::UARTDriver * console
void set_cutoff_frequency(float cutoff_freq)
virtual void delay(uint16_t ms)=0
virtual void printf(const char *,...) FMT_PRINTF(2
LowPassFilterFloat low_pass_filter
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
A class to implement a low pass filter without losing precision even for int types the downside being...
AP_HAL::Scheduler * scheduler
T apply(T sample, float dt)