thomas-haslwanter / scikit-kinematics

Python functions for working with 3D kinematics.
Other
129 stars 45 forks source link

Compensation for gravity hard-coded on 3rd axis #15

Closed ivan866 closed 6 years ago

ivan866 commented 6 years ago

imus.py, line 358 - g is hard-coded in 3rd position, while MEMS accelerometer has vertical axis on Y, positive upwards.

imus.py, line 357 - g constant is hard-coded to 2nd digit, can be taken from scipy.constants.g

thomas-haslwanter commented 6 years ago

I have changed line 357, and will update this in the next upload. It does not make any difference in practice, because most IMUs are not that accurate anyway. Line 358 is correct, though. I always use a space-fixed coordinate system where the z-axis is defined by gravity. If the IMU is oriented differently, it has to be indicated (approximately) by adjusting "R_initialOrientation". The thing about coordinate systems is really confusing, and in fact, I am just about finishing a book on "3D Kinematics" for Springer, which is intended to provide the theoretical background when working in this area. What is your background, and how did you get into this area? I am still working on the 3D viewer (i.e.with OpenGL or PyGame), but have no satisfactory solution yet.

ivan866 commented 6 years ago

I am now an affiliate researcher for some institute and we have a project which uses Tobii Glasses 2 eyetracker, which has MEMS gyro / accel built-in.

My question is how do I define an initial rotation matrix for a case when a person's gaze is headed towards Z axis, and vertical is Y positive, while left shoulder is X positive? I tried http://andre-gaschler.com/rotationconverter/ and it seems that numpy.eye(3) is right. Still I get very high position values (about -100 meters on vertical axis).

And why is it that I must change the initial orientation if I have different axis configuration, I thought I just change columns ordering before setting in_data.

thomas-haslwanter commented 6 years ago

import numpy as np

x = [0,1,0]

y = [0,0,1]

z = [1,0,0]

rot_mat = np.column_stack( (x,y,z) )

assuming the data are in column form

rotated = (rot_mat @ data.T).T

should do the trick


Prof. (FH) PD Dr. Thomas Haslwanter School of Applied Health and Social Sciences University of Applied Sciences Upper Austria FH OÖ Studienbetriebs GmbH Garnisonstraße 21 4020 Linz/Austria Tel.: +43 (0)5 0804 -52170 Fax: +43 (0)5 0804 -52171 E-Mail: Thomas.Haslwanter@fh-linz.at Web: bim.fh-linz.at or work.thaslwanter.at


From: Ivan notifications@github.com Sent: Sunday, December 24, 2017 4:13 PM To: thomas-haslwanter/scikit-kinematics Cc: Haslwanter Thomas; State change Subject: Re: [thomas-haslwanter/scikit-kinematics] Compensation for gravity hard-coded on 3rd axis (#15)

I am now an affiliate researcher for some institute and we have a project which uses Tobii Glasses 2 eyetracker, which has MEMS gyro / accel built-in.

My question is how do I define an initial rotation matrix for a case when a person's gaze is headed towards Z axis, and vertical is Y positive, while left shoulder is X positive?

- You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/thomas-haslwanter/scikit-kinematics/issues/15#issuecomment-353789352, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABdaRV_Wd2Lh1BovBThmgQIHjOiTnUrSks5tDmoMgaJpZM4RLvhf.

ivan866 commented 6 years ago

That code simply reorders axes like that: X->Y, Y->Z, Z->X.

thomas-haslwanter commented 6 years ago

... which is all that should be required if your coordinate system points in the wrong direction ....


Prof. (FH) PD Dr. Thomas Haslwanter School of Applied Health and Social Sciences University of Applied Sciences Upper Austria FH OÖ Studienbetriebs GmbH Garnisonstraße 21 4020 Linz/Austria Tel.: +43 (0)5 0804 -52170 Fax: +43 (0)5 0804 -52171 E-Mail: Thomas.Haslwanter@fh-linz.at Web: bim.fh-linz.at or work.thaslwanter.at


From: Ivan notifications@github.com Sent: Wednesday, January 3, 2018 12:36 AM To: thomas-haslwanter/scikit-kinematics Cc: Haslwanter Thomas; State change Subject: Re: [thomas-haslwanter/scikit-kinematics] Compensation for gravity hard-coded on 3rd axis (#15)

That code simply reorders axes like that: X->Y, Y->Z, Z->X.

- You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/thomas-haslwanter/scikit-kinematics/issues/15#issuecomment-354904232, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABdaRa2-NXC0X1rKtPvvJanMazrz-fRYks5tGr19gaJpZM4RLvhf.