mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-21 10:43:56 +08:00
* complie boardd without python
* not good, but don't want to lose the file, because it works
* clean a bit
* update dbc
* should build on CI
* not good, but don't want to lose the file, because it works
* clean a bit
* should build on CI
* remove unneeded path
* reorder paths
* reduce diff
* and now it works?!
* ... should work in CI
* add kj, 30% chance to fix macos
* pydebug
* new way to find path
* fix :)
* tested
* sanity check
* repl. MacOS flags
* hope it works
* need more logs
* need more logs2
* test if it works
* should work on CI
* correct python file
* should not work
* cleanup
* real cleanup
* more removals
* 50% of file
* transformations
* fixed a hardcoded variable
* more logs
* simpl.
* kalman
* all donw if it passes tests
* cleanup
* reduce code by 20 lines if this works
* fix bugs
* cleanup
* SharedLibrary
* cleanup
* ...
* remove unused
* CI fix maybe?
* add more valid path
* more logs
* ...:
* fix webcam CI
* remove WError flag
* deprecated is not an error
* more Wno things
* reduce diff, add Wno to env
* don't import nonexistent stuff
* SharedLibrary v2
* less custom env
* renaming, remove SharedLibs
* pack libs in envCython
* experiment
* better docker caching
* whitespace
* more docker caching
* improvement
* improvements
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 9529764549
38 lines
978 B
Cython
38 lines
978 B
Cython
# distutils: language = c++
|
|
# cython: language_level=3
|
|
|
|
cdef class KF1D:
|
|
def __init__(self, x0, A, C, K):
|
|
self.x0_0 = x0[0][0]
|
|
self.x1_0 = x0[1][0]
|
|
self.A0_0 = A[0][0]
|
|
self.A0_1 = A[0][1]
|
|
self.A1_0 = A[1][0]
|
|
self.A1_1 = A[1][1]
|
|
self.C0_0 = C[0]
|
|
self.C0_1 = C[1]
|
|
self.K0_0 = K[0][0]
|
|
self.K1_0 = K[1][0]
|
|
|
|
self.A_K_0 = self.A0_0 - self.K0_0 * self.C0_0
|
|
self.A_K_1 = self.A0_1 - self.K0_0 * self.C0_1
|
|
self.A_K_2 = self.A1_0 - self.K1_0 * self.C0_0
|
|
self.A_K_3 = self.A1_1 - self.K1_0 * self.C0_1
|
|
|
|
def update(self, meas):
|
|
cdef double x0_0 = self.A_K_0 * self.x0_0 + self.A_K_1 * self.x1_0 + self.K0_0 * meas
|
|
cdef double x1_0 = self.A_K_2 * self.x0_0 + self.A_K_3 * self.x1_0 + self.K1_0 * meas
|
|
self.x0_0 = x0_0
|
|
self.x1_0 = x1_0
|
|
|
|
return [self.x0_0, self.x1_0]
|
|
|
|
@property
|
|
def x(self):
|
|
return [[self.x0_0], [self.x1_0]]
|
|
|
|
@x.setter
|
|
def x(self, x):
|
|
self.x0_0 = x[0][0]
|
|
self.x1_0 = x[1][0]
|