Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_compute_all skips first element when q0 not None #33

Open
Yushchuk6 opened this issue Feb 28, 2021 · 0 comments
Open

_compute_all skips first element when q0 not None #33

Yushchuk6 opened this issue Feb 28, 2021 · 0 comments

Comments

@Yushchuk6
Copy link

In method def _compute_all(self): of filters that have a parameter q0, computation is 1 element off.

For example, in the AQUA filter:

Q[0] = self.init_q(self.acc[0], self.mag[0]) if self.q0 is None else self.q0.copy()
for t in range(1, num_samples):  
    Q[t] = self.updateMARG(Q[t-1], self.gyr[t], self.acc[t], self.mag[t])

range(1, num_samples) can produce numbers only from 1, which is good if you are using reading [0] as your starting point.
But when q0 is set, it just skips [0] reading.

It can be very crucial if you send a small number of samples.
I'm trying to use def init() result as a real-time filter by sending only one sample + previous Q as q0 and because of this bug it returns only q0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant