-
Notifications
You must be signed in to change notification settings - Fork 57
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
Kalman filter prototype #75
Conversation
f064ce5
to
5dff356
Compare
We need a comparison to the existing
With these, we need to decide whether to keep |
004ac78
to
cb4b28f
Compare
Ah I forgot to answer this conversation, but it seems pretty obvious that Filter is redundant in this context. RIP Filter, we liked you, you were simple and easy to maintain. Other than that, should I start |
So we decide to remove One thing to note is that the float/double difference of tag poses go beyond 10^-5% as you might have seen from the failed Travis build. We need to consider maybe lowering this limit or accepting this difference because it is not likely to go down. |
Hum that's funny. I haven't looked at the changes yet, so I'll just ask: is this test fail due to the PR or to the machine running the Travis thing ? |
This is due to the matrix inversion and multiplications in the PR. That's why it's not likely to go down. |
Well it's really cool to have a test that catches that then. If I remember Numerical Analysis correctly, an error at 10^-5 means +/- 0.1 pixels on a thousand... which is more or less the limit on the (2D) detection in "normal" cases. Si if we really want to be precise, we should use doubles, otherwise floats are OK. Again, it's cool to have a test that "documents" this limit ! |
One thing I noticed is that the matrix elements that have this critical difference are very close to zero. If you look at the translation components for example, they are perfectly accurate. Maybe we should not calculate the difference threshold as relative to compared elements, but as absolute depending on the expected range of compared elements; e.g 1e^-5 absolute for rotation elements since they are in [-1,1] and 1e^-2 millimeters absolute for translation elements which are in 100's of millimeters range most of the time, if not 1000's. |
That makes sense. In the end what we care about is the number of On Sun, Dec 7, 2014 at 5:01 PM, Ayberk Özgür [email protected]
|
fc74e38
to
12c9e42
Compare
Now that we're removing It involves a prediction and correction step where the state (pose of the tag) covariance estimate naturally "increases" during the prediction step and "decreases" during the correction step if "noiseless" observations are done. We do the correction step only when the tag is observed. This means that we can basically take the covariance estimate and discard the tag history if it gets too large. How large is up to the user to calibrate and I think that the magnitude can be taken as the trace of the covariance matrix, up to some coefficients for different diagonal elements since quaternion components and position components have different scales/units. We can even compare it to the trace of the process noise covariance matrix (Q). What do you guys think? |
2e3d073
to
b92e321
Compare
I'm done |
BTW, about the samples demonstrating the IMU API: There will be none in chilitags because this is too platform-specific since it requires access to sensors. There will be one sample in qimchi that uses https://github.com/chili-epfl/qml-imu which can be previewed here: https://github.com/chili-epfl/qimchi/tree/imu. |
Cool ! I should have some time tomorrow. Round one... ;)
That sounds like black magic to me... Maybe to the user too, unless we can explain how to set the threshold in less than two paragraphs involving Kalman's internals. How does it compare to predicting the position with Kalman for |
Okay okay... let's not stall development too much, I already add way too much latency :s |
Everything seems to be OK. |
guys I missed some messages, but quaternions have singularities...you 2015-01-05 9:24 GMT+01:00 Ayberk Özgür [email protected]:
|
As far as I know, there are no singularities in quaternions, that's one of the main reasons why we prefer them (sometimes) over Euler or angle-axis representations. |
sry, you are right. Now I remember: there is still one argument for I don't remember exactly all the pros and cons for this rotation All the best Andrea 2015-01-05 9:37 GMT+01:00 Ayberk Özgür [email protected]:
|
As far as I know, the exponential map concept is exactly what we know as the 3x3 rotation matrix. Due to redundancies, it still has 3 DOF despite storing 9 values. Quaternions store 4 values but they are unit quaternions so one DOF is reduced and they still have 3 DOF. The pro of using 3x3 rotation matrices is that we can do matrix multiplications and combine rotations/rotate vectors very cheaply. This doesn't translate well into things like Kalman filters where we don't have to combine rotations or rotate vectors but we have to process rotations as a state vector. That's why we (at least I) don't use 9 values in the state vector because it's overkill. |
Having read the exponential part of the paper you provided, I would say the concept described there is interesting. It is only very slightly different than what we use (unit quaternions). Still, we (at least I) do a sinc-like epsilon check whenever we would use the norm of the vector part of the quaternion that is the core idea of the slight modification described in the paper; you can see it in https://github.com/ayberkozgur/chilitags/blob/kalman/src/Filter3D.cpp#L280 and https://github.com/ayberkozgur/chilitags/blob/kalman/src/Filter3D.cpp#L297. |
yep that's correct and you divide by quaternion norm. now you have three 2015-01-05 11:12 GMT+01:00 Ayberk Özgür [email protected]:
|
@johnnyx811 I think you mixed up your dates. 1st of January is time for new Years' resolution, not April Fools' jokes... Or did you have a bad break up with Rodrigues ? ;) |
@ayberkozgur I was thinking that it would be nice to have some test or evaluation of Kalman before merging this, but this may take a big while... How annoying is it to wait more ? |
Well, most probably I won't be developing Chilitags until somewhere around the end of March because I have to publish; I'll probably get fired otherwise :) |
@ayberkozgur I confirm :-) |
Well if you get fired coding Chilitags, you'll have more time for more coding. That's a double win for Chilitags ;) Just use a fake GitHub account, I'm sure no one will notice... Join me to the dark side of no publications. We have cookies. So it's not a problem if I stall this until end of March then ? |
It's easy for you to say, you already have your PhD :) I don't see the point of delaying this for three months for added tests. I can understand your desire to have tests for all new features but the current PR is quite big as it is. It would better be suited as an issue for now (not to mention there is another PR waiting on this one). |
Finally merged this PR, since I probably won't add to it before March. R.I.P. hopes of tests ;) Many thanks again ! |
This PR is an early preview of Kalman filtering to 6D tag pose. Comes with hardcore c++11
std::map::emplace()
and related syntax :)Is a partial solution to #19.
For now, the quick & dirty covariance calibration seems to work decent enough. Please test further.
A huge issue now is gimbal lock and discontinuities in angle. We need quaternions to fix this.doneIn the near future, more goodies such as
Calibration APIdoneEnable/disable on demand APIdoneQuaternionsdoneIMU integrationdone, see also https://github.com/chili-epfl/qml-imuOptimizationspretty much doneSampledoneRemovedoneFilter
completelyAdd tag discard mechanismdoneFully document all math involveddonewill follow.