What is the theory behind this calculation?
For a human readable introduction I would recommend:
The Balance Filter: A Simple Solution for Integrating Accelerometer and Gyroscope Measurements for a Balancing Platform.
How do we choose the time_constant properly?
Intuitively, the time_constant
is the boundary between trusting the high-pass and the low-pass filter part. For shorter times than the time_constant
you trust the high-pass filter part more, and for longer times you trust the low-pass part more.
Usually, you have some experience with the physical process you are dealing with and you can guess at least the order of magnitude of the time_constant
. For example, if you are fusing accelerometer and gyro data (which I assume you do based on your other question), something between 0.5-1 second is a reasonable first guess. Then, you start tuning your filter by analyzing its performance on actual data and adjusting a
accordingly.