ellipsoid_fit_python icon indicating copy to clipboard operation
ellipsoid_fit_python copied to clipboard

Using data from get_calibration_ellipsoid.py

Open fe64970103 opened this issue 3 years ago • 3 comments

Hello.

First thank you for the great work. It's been a while past my university graduation and I'm having issues with the matrices and all the math stuff. Anyway I?m trying to make sense of all of it.

One dumb question. Once I generate the ellipsoid parameters with get_calibration_ellipsoid.py, how do I then apply those parameters to real-time incoming data from a sensor? Can you add that example too?

Thanks, Marko

fe64970103 avatar Sep 29 '21 08:09 fe64970103

Thank you for kind words. It's been a while for me too. As far as I remember the example is already there - the calibrated data is the data projected onto the sphere. I think, it's this line https://github.com/aleksandrbazhin/ellipsoid_fit_python/blob/0366607584df22d68a399cd3d954cb8ccbaef94d/plot_ellipsoid.py#L23

aleksandrbazhin avatar Sep 29 '21 09:09 aleksandrbazhin

Thank you for kind words. It's been a while for me too. As far as I remember the example is already there - the calibrated data is the data projected onto the sphere. I think, it's this line

https://github.com/aleksandrbazhin/ellipsoid_fit_python/blob/0366607584df22d68a399cd3d954cb8ccbaef94d/plot_ellipsoid.py#L23

I think that Marko asks for an example in real-time. For example, when you are getting raw data from magnetometer, how do you use the [center, radii, evecs, Coefficients, etc] which get_calibration_ellipsoid showed you, for correcting every [x,y,z] which you are getting from magnetometer?. That example he wants I think.

zrafa avatar Mar 16 '24 11:03 zrafa

Yeah maybe it's not obvious enough. If anyone will read this, I think what you need is to save the output of ellipsoid_fit() or transformation (TR and center) on calibration, and when you receive new data, do something like

calibrated_data = TR.dot(data - center)

assuming data has [x, y, z] column vectors. Other transposes and stuff are specific to plotting, so add those when you need. I think the transformation matrix TR obtained that way does not account for translation, that's why center is needed. Unfortunately I can not verify or test it right - I do not have a development setup, and haven't touched the field for more than several years at that point. The code was just a snippet I thought can be useful when I worked on it. If I am not correct - fix me.

aleksandrbazhin avatar Mar 16 '24 16:03 aleksandrbazhin