-
Notifications
You must be signed in to change notification settings - Fork 16
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
filter for rotation matrix #37
Comments
I've never used it for quaternion, kalman-filter can do lot of things i'm not aware of everything that can be done.
Can you share your reference ? |
Thank for the fast response. I obtain the rotation matrix (3x3) from an object detection algorithm at each frame. the results that I obtain are very jittery, and I would like to smooth the orientation positions of those received data. I need those orientation data to be applied to a 3d model. If I convert this matrix to Euler angles and apply the rotation to my model, I see very jittery results when the angle is close to 360( i assume because of the gimbal lock?) so I'm trying to work with quaternions but I don't know if Kalman is useful for this. |
I share you my thoughts, i might be totally off topic. Kalman filter are working with linear observation, i feel rotation matrix are a group for the matrix multiplication, but i feel (might be wrong) they are not a group considering the matrix addition, so KF won't work. In other words, considering 2 observations vectors (of the same phenomena) A and B (for 3x3 matrix, A will be a 9 vector), to use kalman filter, you should be sure that (A+B)/2 is the average observation of A and B. I might be wrong but i feel that the observation model of 3x3 matrix is not fullfilling this property, and we have no garantee that (A+B)/2 is even a rotation matrix Quaternions will face the same problem, kf will give you no easy way to garantee x² + y² + z² + w² Anyway, quaternions will still be much better than 3x3 matrix, and you can still consider that you will renormalize the output of the kalman filter, and that (A+B)/2 makes sense when renormalized, i feel it's not as easy for strict mathematical approach, but maybe it will work as kind of first order solution ?! Or maybe it is simply working (as projective geometry might work here) About the "extended" kalman filter, it is more for non-linear dynamic model, if you just need smoothing, without any specific dynamic model, i feel that your dynamic model will be very simple ('constant-position') and linear, and you do not need this here. My understanding of your problem here is more about the linearity of your observation. Once again, i might be totally wrong here, so i would be very interested if you can share your findings, and an extract of an extract of 10 quaterinons data you want to smooth. |
Thank you very much, I'll check this now. |
Yes, i feel that you will need to renormalize quaternions anyway in the output, it might create some strange behavior, please keep me posted of the progress If you can create a better observablehq (or a fiddle) about this, explaining your steps, please share it, i could use as an example in the README.md for the community |
Hi, I'm implementing your solution. Can I ask you the difference between the state projection matrix and the observed projection matrix? why I cannot define both of them? |
this comment to show you the results!! seems nice! var {KalmanFilter} = kalmanFilter; Some points before filtering: [[0.08894225713878627,-0.5302104332063636,-0.30453416750449797,0.6754148494651938],[0.12879511140275168,-0.5232952149453235,-0.284579420977486,0.6905897526894842],[0.15174833319192843,-0.49756866414062917,-0.2795917631958591,0.7033092942708244],[0.1617475768810654,-0.5035413904274849,-0.27670332544092946,0.6914987212645157],[0.18346162827436677,-0.483921057269954,-0.2674546121457084,0.703951601415562],[0.1777013477039221,-0.48934407900438026,-0.26964251463218025,0.6988927856250534],[0.1818462135858313,-0.4972201683865893,-0.2657518939388442,0.6955832238095053],[0.1892058358620858,-0.4943509285171406,-0.2551328838406259,0.7044902957217181],[0.1847703978873224,-0.4883924292567647,-0.26132254568963403,0.6978236986723692],[0.19653686836452416,-0.47444767785029635,-0.26089390518982203,0.707588031235516],[0.19105649542885123,-0.474987895150619,-0.25907950674801755,0.7139178152435416],[0.1916911141029046,-0.47231766758877664,-0.26085417602383737,0.7110440516927258],[0.1927464250310751,-0.48128887074007237,-0.2543402625586021,0.7113310715516392],[0.1849769627884189,-0.4719236775980047,-0.26285463011483895,0.716068881047498],[0.18517611121423672,-0.47182380031340293,-0.266677978030859,0.7094192356783041],[0.17990255314939388,-0.4795653513734308,-0.25973510129600214,0.7190263711800358],[0.18511817503580832,-0.46950235431083487,-0.2670309077818661,0.7143761921247538],[0.18397237794878177,-0.46644914080036903,-0.26205332840662765,0.7234727226972546],[0.18480371204952042,-0.4706100800440734,-0.2682825796750029,0.7103857697013971],[0.18374166891893326,-0.47002337920314075,-0.2635744336014278,0.7243721248963048],[0.18581566283123377,-0.4690208721534061,-0.2699238828264765,0.7133808840933764]] some points after filtering [[0.08894136772599842,-0.5302051311603541,-0.30453112219632134,0.675408095390994],[0.10981704785256907,-0.5265856669068485,-0.29408027632338357,0.6833603576458286],[0.12592551143892,-0.5154383975431321,-0.28851432039700936,0.6910240082258057],[0.13761137574728705,-0.5115573591632078,-0.2846613408800558,0.6911788689823619],[0.15131352952808372,-0.5032983673888389,-0.2795191828724585,0.6949959459744093],[0.15883735365922777,-0.4993196522491361,-0.27670309878599353,0.6961070320067346],[0.1652348164073108,-0.4987359045170151,-0.2736581880307562,0.6959613905694968],[0.17181086947701876,-0.4975329588125584,-0.2685760769542282,0.6983011547590561],[0.17534071532139983,-0.49504331109958233,-0.2666003995699293,0.6981711078676796],[0.18109199371739473,-0.4894549753144302,-0.2650520224762933,0.7007262577485087],[0.18379022221097663,-0.4855375202276346,-0.2634347602605749,0.7042983215946014],[0.1859273384874644,-0.4819616755465882,-0.2627367367145479,0.7061229775684698],[0.18777077106312187,-0.4817797933708073,-0.2604668822581267,0.7075309036952698],[0.1870157414994299,-0.47911616793200446,-0.261112173575639,0.7098383008683096],[0.1865186610426973,-0.4771457212310055,-0.2626160913154987,0.7097250666398207],[0.18473110041851445,-0.47779946443432647,-0.2618376964645428,0.7122381220521199],[0.18483567657722805,-0.47555782970455635,-0.26324074917502654,0.7128157656000739],[0.18460244450085816,-0.4730969912922975,-0.26291995101525556,0.7156948900995923],[0.18465681899765846,-0.4724251266593353,-0.26436872026215436,0.7142605766594835],[0.18440958353720588,-0.4717762744633652,-0.2641541370666094,0.7169922961253239],[0.18478944621489166,-0.4710318822345569,-0.2657128763804007,0.7160166465652252]] |
Let's define
In your use case, The internal For example when using
Then the
In the lib you can either use
Great ! Thanks for sharing I'm closing the issue |
Hello, sorry to reopen the issue but I have some questions on the theoretical aspect of this. in the following example I have questions about the matrices: const kFilter = new KalmanFilter({ } I hope you can help me clarify this, thank you |
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6339217/ Although there are other mathematical tools used for estimation [1], the Kalman Filter [2] has become the algorithm par excellence in this area. Because of its simplicity, the rigor and elegance in its mathematical derivation, and its recursive nature it is very attractive for many practical applications. Its non-linear versions have been widely used in orientation estimation: the Extended Kalman Filter (EKF), and the Unscented Kalman Filter (UKF) [3]. However, there are problems arising from the used parametrization to represent the orientation. Also, here is written this, so Im wondering if this is the right way to proceed. Ill investigate more this |
Let's consider a 1 dimension problem, with 1 variable In a kalman-filter, you will always "predict" the next point considering the previous point. constant-position"constant-position" model means that you do constant-speedin a And the constant-acceleration
and state will be questions in commentsTo be more precise about matrix meaning, i made this correspondance table with wikipedia article
|
ok thank you for the clarification |
Is this library suitable for smoothiing the values received from a rotation matrix? I can retrieve the quaternion from my rotation matrix but then I dont know how to implement the filter. I saw online that I need the Extended Kalman Filter. Any suggestions on this??
The text was updated successfully, but these errors were encountered: